Class: Warp::ActionMatchers::Matcher
- Defined in:
- lib/warp/action_matchers/matcher.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(model) ⇒ Matcher
Returns a new instance of Matcher.
8 9 10 |
# File 'lib/warp/action_matchers/matcher.rb', line 8 def initialize(model) @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
6 7 8 |
# File 'lib/warp/action_matchers/matcher.rb', line 6 def model @model end |
Instance Method Details
#matches?(actual) ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/warp/action_matchers/matcher.rb', line 12 def matches?(actual) check_callable!(actual) instrument = Warp::Instrument.for(model, instrument_method) instrument.reset instrument.run { actual.call } instrument.calls.size > 0 end |