Class: RSpec::Core::SharedExampleGroupInclusionStackFrame
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb
Overview
Contains information about the inclusion site of a shared example group.
Instance Attribute Summary collapse
-
#inclusion_location ⇒ String
readonly
The location where the shared example was included.
-
#shared_group_name ⇒ String
readonly
The name of the shared example group.
Class Method Summary collapse
- .current_backtrace ⇒ Object
- .shared_example_group_inclusions ⇒ Object
- .with_frame(name, location) ⇒ Object
Instance Method Summary collapse
-
#description ⇒ String
Description of this stack frame, in the form used by RSpec’s built-in formatters.
-
#formatted_inclusion_location ⇒ String
The #inclusion_location, formatted for display by a formatter.
-
#initialize(shared_group_name, inclusion_location) ⇒ SharedExampleGroupInclusionStackFrame
constructor
A new instance of SharedExampleGroupInclusionStackFrame.
Constructor Details
#initialize(shared_group_name, inclusion_location) ⇒ SharedExampleGroupInclusionStackFrame
Returns a new instance of SharedExampleGroupInclusionStackFrame.
789 790 791 792 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb', line 789 def initialize(shared_group_name, inclusion_location) @shared_group_name = shared_group_name @inclusion_location = inclusion_location end |
Instance Attribute Details
#inclusion_location ⇒ String (readonly)
Returns the location where the shared example was included.
786 787 788 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb', line 786 def inclusion_location @inclusion_location end |
#shared_group_name ⇒ String (readonly)
Returns the name of the shared example group.
784 785 786 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb', line 784 def shared_group_name @shared_group_name end |
Class Method Details
.current_backtrace ⇒ Object
811 812 813 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb', line 811 def self.current_backtrace shared_example_group_inclusions.reverse end |
.shared_example_group_inclusions ⇒ Object
829 830 831 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb', line 829 def self.shared_example_group_inclusions RSpec::Support.thread_local_data[:shared_example_group_inclusions] ||= [] end |
.with_frame(name, location) ⇒ Object
816 817 818 819 820 821 822 823 824 825 826 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/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 Method Details
#description ⇒ String
Returns Description of this stack frame, in the form used by RSpec’s built-in formatters.
805 806 807 808 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/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
Returns The #inclusion_location, formatted for display by a formatter.
795 796 797 798 799 800 801 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/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 |