Class: RR::Integrations::RSpec::InvocationMatcher
- Inherits:
-
SpyVerificationProxy
- Object
- SpyVerificationProxy
- RR::Integrations::RSpec::InvocationMatcher
- Defined in:
- lib/rr/integrations/rspec/invocation_matcher.rb
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
-
#spy_verification_proxy ⇒ Object
readonly
Returns the value of attribute spy_verification_proxy.
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.
7 8 9 10 11 |
# File 'lib/rr/integrations/rspec/invocation_matcher.rb', line 7 def initialize(method = nil) @verification = nil @subject = 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
28 29 30 31 32 33 34 35 |
# File 'lib/rr/integrations/rspec/invocation_matcher.rb', line 28 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.
5 6 7 |
# File 'lib/rr/integrations/rspec/invocation_matcher.rb', line 5 def @failure_message end |
#spy_verification_proxy ⇒ Object (readonly)
Returns the value of attribute spy_verification_proxy.
5 6 7 |
# File 'lib/rr/integrations/rspec/invocation_matcher.rb', line 5 def spy_verification_proxy @spy_verification_proxy end |
Instance Method Details
#matches?(subject) ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rr/integrations/rspec/invocation_matcher.rb', line 13 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
24 25 26 |
# File 'lib/rr/integrations/rspec/invocation_matcher.rb', line 24 def nil? false end |