Class: RSpec::Core::SharedExampleGroupInclusionStackFrame
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-core/lib/rspec/core/example_group.rb |
Overview
Contains information about the inclusion site of a shared example group.
Class Method Summary
- .current_backtrace Internal use only Internal use only
- .new(shared_group_name, inclusion_location) ⇒ SharedExampleGroupInclusionStackFrame constructor Internal use only Internal use only
- .shared_example_group_inclusions Internal use only Internal use only
- .with_frame(name, location) Internal use only Internal use only
Instance Attribute Summary
- #inclusion_location ⇒ String readonly
- #shared_group_name ⇒ String readonly
Instance Method Summary
Class Method Details
.current_backtrace
This method is for internal use only.
[ GitHub ]
# File 'rspec-core/lib/rspec/core/example_group.rb', line 811
def self.current_backtrace shared_example_group_inclusions.reverse end
.with_frame(name, location)
This method is for internal use only.
[ GitHub ]
# File 'rspec-core/lib/rspec/core/example_group.rb', line 816
def self.with_frame(name, location) current_stack = shared_example_group_inclusions if current_stack.any? { |frame| frame.shared_group_name == name } raise ArgumentError, "can't include shared examples recursively" else current_stack << new(name, location) yield end ensure current_stack.pop end
Instance Attribute Details
#inclusion_location ⇒ String
(readonly)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 786
attr_reader :inclusion_location
Instance Method Details
#description ⇒ String
# File 'rspec-core/lib/rspec/core/example_group.rb', line 805
def description @description ||= "Shared Example Group: #{shared_group_name.inspect} " \ "called from #{formatted_inclusion_location}" end
#formatted_inclusion_location ⇒ String
# File 'rspec-core/lib/rspec/core/example_group.rb', line 795
def formatted_inclusion_location @formatted_inclusion_location ||= begin RSpec.configuration.backtrace_formatter.backtrace_line( inclusion_location.sub(/(:\d+):in .+$/, '\1') ) end end