class RSpec::Core::SharedExampleGroupInclusionStackFrame

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

Attributes

inclusion_location[R]

@return [String] the location where the shared example was included

shared_group_name[R]

@return [String] the name of the shared example group

Public Class Methods

current_backtrace() click to toggle source

@private

# File lib/rspec/core/example_group.rb, line 732
def self.current_backtrace
  shared_example_group_inclusions.reverse
end
new(shared_group_name, inclusion_location) click to toggle source
# File lib/rspec/core/example_group.rb, line 710
def initialize(shared_group_name, inclusion_location)
  @shared_group_name  = shared_group_name
  @inclusion_location = inclusion_location
end
shared_example_group_inclusions() click to toggle source

@private

# File lib/rspec/core/example_group.rb, line 746
def self.shared_example_group_inclusions
  RSpec::Support.thread_local_data[:shared_example_group_inclusions] ||= []
end
with_frame(name, location) { || ... } click to toggle source

@private

# File lib/rspec/core/example_group.rb, line 737
def self.with_frame(name, location)
  current_stack = shared_example_group_inclusions
  current_stack << new(name, location)
  yield
ensure
  current_stack.pop
end

Public Instance Methods

description() click to toggle source

@return [String] Description of this stack frame, in the form used by

RSpec's built-in formatters.
# File lib/rspec/core/example_group.rb, line 726
def description
  @description ||= "Shared Example Group: #{shared_group_name.inspect} "            "called from #{formatted_inclusion_location}"
end
formatted_inclusion_location() click to toggle source

@return [String] The {#inclusion_location}, formatted for display by a formatter.

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