Class: RSpec::Core::SharedExampleGroupInclusionStackFrame

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/core/example_group.rb

Overview

Contains information about the inclusion site of a shared example group.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (SharedExampleGroupInclusionStackFrame) initialize(shared_group_name, inclusion_location)

Returns a new instance of SharedExampleGroupInclusionStackFrame

690
691
692
693
# File 'lib/rspec/core/example_group.rb', line 690
def initialize(shared_group_name, inclusion_location)
  @shared_group_name  = shared_group_name
  @inclusion_location = inclusion_location
end

Instance Attribute Details

- (String) inclusion_location (readonly)

Returns the location where the shared example was included

Returns:

  • (String)

    the location where the shared example was included

688
689
690
# File 'lib/rspec/core/example_group.rb', line 688
def inclusion_location
  @inclusion_location
end

- (String) shared_group_name (readonly)

Returns the name of the shared example group

Returns:

  • (String)

    the name of the shared example group

686
687
688
# File 'lib/rspec/core/example_group.rb', line 686
def shared_group_name
  @shared_group_name
end

Instance Method Details

- (String) description

Returns Description of this stack frame, in the form used by RSpec's built-in formatters.

Returns:

  • (String)

    Description of this stack frame, in the form used by RSpec's built-in formatters.

706
707
708
709
# File 'lib/rspec/core/example_group.rb', line 706
def description
  @description ||= "Shared Example Group: #{shared_group_name.inspect} " \
    "called from #{formatted_inclusion_location}"
end

- (String) formatted_inclusion_location

Returns The #inclusion_location, formatted for display by a formatter.

Returns:

696
697
698
699
700
701
702
# File 'lib/rspec/core/example_group.rb', line 696
def formatted_inclusion_location
  @formatted_inclusion_location ||= begin
    RSpec.configuration.backtrace_formatter.backtrace_line(
      inclusion_location.sub(/(:\d+):in .+$/, '\1')
    )
  end
end