Module: RSpec::Matchers

Defined in:
lib/rspec/matchers/fail_matchers.rb,
lib/rspec/matchers/before_and_after.rb

Defined Under Namespace

Modules: FailMatchers

Instance Method Summary collapse

Instance Method Details

#before_and_after(before_proc, after_proc) ⇒ Object

Applied to a proc, specifies that its execution will cause some value to change.

Allows you to run a pair of related checks — one before the change and one after the change. The checks can be any arbitrary RSpec expectations.

Parameters:

  • before_proc (Proc)

    The expectation to check before making the change.

  • after_proc (Proc)

    The expectation to check after making the change.



12
13
14
# File 'lib/rspec/matchers/before_and_after.rb', line 12

def before_and_after(before_proc, after_proc)
  BeforeAndAfter.new(before_proc, after_proc)
end