Class: RR::SpyVerification
- Inherits:
-
Object
- Object
- RR::SpyVerification
- Includes:
- DoubleDefinitions::DoubleDefinition::ArgumentDefinitionConstructionMethods, DoubleDefinitions::DoubleDefinition::TimesDefinitionConstructionMethods
- Defined in:
- lib/rr/spy_verification.rb
Instance Attribute Summary collapse
-
#argument_expectation ⇒ Object
readonly
Returns the value of attribute argument_expectation.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#times_matcher ⇒ Object
readonly
Returns the value of attribute times_matcher.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(subject, method_name, args, kwargs) ⇒ SpyVerification
constructor
A new instance of SpyVerification.
- #ordered ⇒ Object
- #ordered? ⇒ Boolean
- #subject_inspect ⇒ Object
- #to_proc ⇒ Object
Methods included from DoubleDefinitions::DoubleDefinition::ArgumentDefinitionConstructionMethods
#with, #with_any_args, #with_no_args
Methods included from DoubleDefinitions::DoubleDefinition::TimesDefinitionConstructionMethods
#any_number_of_times, #at_least, #at_most, #never, #once, #times, #twice
Constructor Details
#initialize(subject, method_name, args, kwargs) ⇒ SpyVerification
Returns a new instance of SpyVerification.
3 4 5 6 7 8 9 |
# File 'lib/rr/spy_verification.rb', line 3 def initialize(subject, method_name, args, kwargs) @subject = subject @method_name = method_name.to_sym set_argument_expectation_for_args(args, kwargs) @ordered = false once end |
Instance Attribute Details
#argument_expectation ⇒ Object (readonly)
Returns the value of attribute argument_expectation.
11 12 13 |
# File 'lib/rr/spy_verification.rb', line 11 def argument_expectation @argument_expectation end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
11 12 13 |
# File 'lib/rr/spy_verification.rb', line 11 def method_name @method_name end |
#subject ⇒ Object
Returns the value of attribute subject.
12 13 14 |
# File 'lib/rr/spy_verification.rb', line 12 def subject @subject end |
#times_matcher ⇒ Object
Returns the value of attribute times_matcher.
11 12 13 |
# File 'lib/rr/spy_verification.rb', line 11 def times_matcher @times_matcher end |
Instance Method Details
#call ⇒ Object
26 27 28 |
# File 'lib/rr/spy_verification.rb', line 26 def call (error = RR.recorded_calls.match_error(self)) && raise(error) end |
#ordered ⇒ Object
17 18 19 20 |
# File 'lib/rr/spy_verification.rb', line 17 def ordered @ordered = true self end |
#ordered? ⇒ Boolean
22 23 24 |
# File 'lib/rr/spy_verification.rb', line 22 def ordered? @ordered end |
#subject_inspect ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/rr/spy_verification.rb', line 36 def subject_inspect if subject.respond_to?(:__rr__original_inspect, true) subject.__rr__original_inspect else subject.inspect end end |
#to_proc ⇒ Object
30 31 32 33 34 |
# File 'lib/rr/spy_verification.rb', line 30 def to_proc lambda do call end end |