Class: RSpec::Rewind::ExampleContext
- Inherits:
-
Object
- Object
- RSpec::Rewind::ExampleContext
- Defined in:
- lib/rspec/rewind/example_context.rb
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(example:) ⇒ ExampleContext
constructor
A new instance of ExampleContext.
- #metadata ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(example:) ⇒ ExampleContext
Returns a new instance of ExampleContext.
6 7 8 |
# File 'lib/rspec/rewind/example_context.rb', line 6 def initialize(example:) @example = example end |
Instance Method Details
#id ⇒ Object
22 23 24 |
# File 'lib/rspec/rewind/example_context.rb', line 22 def id source.respond_to?(:id) ? source.id : 'unknown' end |
#metadata ⇒ Object
16 17 18 19 20 |
# File 'lib/rspec/rewind/example_context.rb', line 16 def return {} unless source.respond_to?(:metadata) source. || {} end |
#source ⇒ Object
10 11 12 13 14 |
# File 'lib/rspec/rewind/example_context.rb', line 10 def source return @example.example if @example.respond_to?(:example) && @example.example @example end |