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

Methods

Classes and Modules

Module RSpec::Core::Example::NotPendingExampleFixed
Module RSpec::Core::Example::Procsy

External Aliases

pending -> pending?

Attributes

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.

Public Class methods

@private

Used to define methods that delegate to this example‘s metadata

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.

Public Instance methods

Returns the example group class that provides the context for running this example.

@private

Used internally to set an exception and fail without actually executing the example when an exception is raised in before(:all).

@deprecated access options via metadata instead

@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

@private

Used internally to set an exception in an after hook, which captures the exception but doesn‘t raise it.

[Validate]