Class: RR::Adapters::Rspec::InvocationMatcher
- Inherits:
-
SpyVerificationProxy
- Object
- SpyVerificationProxy
- RR::Adapters::Rspec::InvocationMatcher
- Defined in:
- lib/rr/adapters/rspec.rb
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
Instance Method Summary collapse
-
#initialize(method = nil) ⇒ InvocationMatcher
constructor
A new instance of InvocationMatcher.
- #matches?(subject) ⇒ Boolean
- #method_missing(method_name, *args, &block) ⇒ Object
- #nil? ⇒ Boolean
Constructor Details
#initialize(method = nil) ⇒ InvocationMatcher
Returns a new instance of InvocationMatcher.
29 30 31 |
# File 'lib/rr/adapters/rspec.rb', line 29 def initialize(method = nil) method_missing(method) if method end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/rr/adapters/rspec.rb', line 48 def method_missing(method_name, *args, &block) if @verification @verification.send(method_name, *args) else @verification = super end self end |
Instance Attribute Details
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
27 28 29 |
# File 'lib/rr/adapters/rspec.rb', line 27 def @failure_message end |
Instance Method Details
#matches?(subject) ⇒ Boolean
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rr/adapters/rspec.rb', line 33 def matches?(subject) @verification.subject = subject calls = RR::Space.instance.recorded_calls if error = calls.match_error(@verification) @failure_message = error. false else true end end |
#nil? ⇒ Boolean
44 45 46 |
# File 'lib/rr/adapters/rspec.rb', line 44 def nil? false end |