Method: RSpec::Core::Example#initialize

Defined in:
lib/rspec/core/example.rb

#initialize(example_group_class, description, metadata, example_block = nil) ⇒ Example

Creates a new instance of Example.

Parameters:

  • example_group_class

    the subclass of ExampleGroup in which this Example is declared

  • description

    the String passed to the ‘it` method (or alias)

  • metadata

    additional args passed to ‘it` to be used as metadata

  • example_block (defaults to: nil)

    the block of code that represents the example



45
46
47
48
49
50
# File 'lib/rspec/core/example.rb', line 45

def initialize(example_group_class, description, , example_block=nil)
  @example_group_class, @options, @example_block = example_group_class, , example_block
  @metadata  = @example_group_class..for_example(description, )
  @exception = nil
  @pending_declared_in_example = false
end