Parent

Methods

Class/Module Index [+]

Quicksearch

RSpec::Core::Example::Procsy

Wraps both a `Proc` and an {Example} for use in {Hooks#around around} hooks. In around hooks we need to yield this special kind of object (rather than the raw {Example}) because when there are multiple `around` hooks we have to wrap them recursively.

@example

RSpec.configure do |c|
  c.around do |ex| # Procsy which wraps the example
    if ex.metadata[:key] == :some_value && some_global_condition
      raise "some message"
    end
    ex.run         # run delegates to ex.call
  end
end

@note This class also exposes the instance methods of {Example},

proxying them through to the wrapped {Example} instance.

Attributes

example[R]

The {Example} instance.

Public Class Methods

new(example, &block) click to toggle source
# File lib/rspec/core/example.rb, line 214
def initialize(example, &block)
  @example = example
  @proc    = block
end

Public Instance Methods

wrap(&block) click to toggle source

@private

# File lib/rspec/core/example.rb, line 220
def wrap(&block)
  self.class.new(example, &block)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.