Class | RSpec::Core::Example |
In: |
lib/rspec/core/example.rb
|
Parent: | Object |
Wrapper for an instance of a subclass of [ExampleGroup](ExampleGroup). An instance of `Example` is returned by the [example](ExampleGroup#example-instance_method) method available in examples, [before](Hooks#before-instance_method) and [after](Hooks#after-instance_method) hooks, and yielded to [around](Hooks#around-instance_method) hooks. @see ExampleGroup
pending | -> | pending? |
example_group_instance | [R] |
@attr_reader @private
Returns the example_group_instance that provides the context for running this example. |
exception | [R] |
@attr_reader
Returns the first exception raised in the context of running this example (nil if no exception is raised) |
metadata | [R] |
@attr_reader
Returns the metadata object associated with this example. |
Creates a new instance of Example. @param example_group_class the subclass of ExampleGroup in which this Example is declared @param description the String passed to the `it` method (or alias) @param metadata additional args passed to `it` to be used as metadata @param example_block the block of code that represents the example
@private
Wraps the example block in a Proc so it can invoked using `run` or `call` in [around](../Hooks#around-instance_method) hooks.
@private
Used internally to set an exception and fail without actually executing the example when an exception is raised in before(:all).
@api private @param example_group_instance the instance of an ExampleGroup subclass instance_evals the block submitted to the constructor in the context of the instance of ExampleGroup