class RSpec::Core::Example

def initialize(example_group_class, description, user_metadata, example_block=nil)

Other tags:
    Api: - private

Parameters:
  • example_block (Proc) -- the block of code that represents the
  • user_metadata (Hash) -- additional args passed to `it` to be used as
  • description (String) -- the String passed to the `it` method (or
  • example_group_class (Class) -- the subclass of ExampleGroup in which
def initialize(example_group_class, description, user_metadata, example_block=nil)
  @example_group_class = example_group_class
  @example_block       = example_block
  @metadata = Metadata::ExampleHash.create(
    @example_group_class.metadata, user_metadata,
    example_group_class.method(:next_runnable_index_for),
    description, example_block
  )
  # This should perhaps be done in `Metadata::ExampleHash.create`,
  # but the logic there has no knowledge of `RSpec.world` and we
  # want to keep it that way. It's easier to just assign it here.
  @metadata[:last_run_status] = RSpec.configuration.last_run_statuses[id]
  @example_group_instance = @exception = nil
  @clock = RSpec::Core::Time
  @reporter = RSpec::Core::NullReporter
end