Class: BeforeAndAfter
- Inherits:
-
RSpec::Matchers::BuiltIn::BaseMatcher
- Object
- RSpec::Matchers::BuiltIn::BaseMatcher
- BeforeAndAfter
- Defined in:
- lib/rspec/matchers/before_and_after.rb
Overview
Modeled after RSpec::Matchers::BuiltIn::Change
Instance Method Summary collapse
-
#initialize(before_proc, after_proc) ⇒ BeforeAndAfter
constructor
A new instance of BeforeAndAfter.
- #matches?(event_proc) ⇒ Boolean
- #supports_block_expectations? ⇒ Boolean
Constructor Details
#initialize(before_proc, after_proc) ⇒ BeforeAndAfter
21 22 23 24 |
# File 'lib/rspec/matchers/before_and_after.rb', line 21 def initialize(before_proc, after_proc) @before_proc = before_proc @after_proc = after_proc end |
Instance Method Details
#matches?(event_proc) ⇒ Boolean
26 27 28 29 |
# File 'lib/rspec/matchers/before_and_after.rb', line 26 def matches?(event_proc) @event_proc = event_proc perform_change(event_proc) end |
#supports_block_expectations? ⇒ Boolean
31 32 33 |
# File 'lib/rspec/matchers/before_and_after.rb', line 31 def supports_block_expectations? true end |