Class: RR::RecordedCalls
- Inherits:
-
Object
- Object
- RR::RecordedCalls
- Includes:
- Space::Reader
- Defined in:
- lib/rr/recorded_calls.rb
Instance Attribute Summary collapse
-
#recorded_calls ⇒ Object
readonly
Returns the value of attribute recorded_calls.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](index) ⇒ Object
- #add(subject, method_name, arguments, keyword_arguments, block) ⇒ Object
- #any?(&block) ⇒ Boolean
- #clear ⇒ Object
-
#initialize(recorded_calls = []) ⇒ RecordedCalls
constructor
A new instance of RecordedCalls.
- #match_error(spy_verification) ⇒ Object
Methods included from Space::Reader
Constructor Details
#initialize(recorded_calls = []) ⇒ RecordedCalls
Returns a new instance of RecordedCalls.
5 6 7 8 |
# File 'lib/rr/recorded_calls.rb', line 5 def initialize(recorded_calls=[]) @recorded_calls = recorded_calls @ordered_index = 0 end |
Instance Attribute Details
#recorded_calls ⇒ Object (readonly)
Returns the value of attribute recorded_calls.
10 11 12 |
# File 'lib/rr/recorded_calls.rb', line 10 def recorded_calls @recorded_calls end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 |
# File 'lib/rr/recorded_calls.rb', line 33 def ==(other) recorded_calls == other.recorded_calls end |
#[](index) ⇒ Object
12 13 14 |
# File 'lib/rr/recorded_calls.rb', line 12 def [](index) @recorded_calls[index] end |
#add(subject, method_name, arguments, keyword_arguments, block) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/rr/recorded_calls.rb', line 21 def add(subject, method_name, arguments, keyword_arguments, block) recorded_calls << RecordedCall.new(subject, method_name, arguments, keyword_arguments, block) end |
#any?(&block) ⇒ Boolean
29 30 31 |
# File 'lib/rr/recorded_calls.rb', line 29 def any?(&block) recorded_calls.any?(&block) end |
#clear ⇒ Object
16 17 18 19 |
# File 'lib/rr/recorded_calls.rb', line 16 def clear self.ordered_index = 0 recorded_calls.clear end |
#match_error(spy_verification) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/rr/recorded_calls.rb', line 37 def match_error(spy_verification) double_injection_exists_error(spy_verification) || begin if spy_verification.ordered? ordered_match_error(spy_verification) else unordered_match_error(spy_verification) end end end |