Class: RR::Expectations::ArgumentEqualityExpectation
- Inherits:
-
Object
- Object
- RR::Expectations::ArgumentEqualityExpectation
- Defined in:
- lib/rr/expectations/argument_equality_expectation.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#expected_arguments ⇒ Object
readonly
Returns the value of attribute expected_arguments.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #exact_match?(*arguments) ⇒ Boolean
-
#initialize(*expected_arguments) ⇒ ArgumentEqualityExpectation
constructor
A new instance of ArgumentEqualityExpectation.
- #wildcard_match?(*arguments) ⇒ Boolean
Constructor Details
#initialize(*expected_arguments) ⇒ ArgumentEqualityExpectation
Returns a new instance of ArgumentEqualityExpectation.
6 7 8 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 6 def initialize(*expected_arguments) @expected_arguments = expected_arguments end |
Instance Attribute Details
#expected_arguments ⇒ Object (readonly)
Returns the value of attribute expected_arguments.
4 5 6 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 4 def expected_arguments @expected_arguments end |
Instance Method Details
#==(other) ⇒ Object
27 28 29 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 27 def ==(other) @expected_arguments == other.expected_arguments end |
#exact_match?(*arguments) ⇒ Boolean
10 11 12 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 10 def exact_match?(*arguments) @expected_arguments == arguments end |
#wildcard_match?(*arguments) ⇒ Boolean
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 14 def wildcard_match?(*arguments) return false unless arguments.length == @expected_arguments.length arguments.each_with_index do |arg, index| expected_argument = @expected_arguments[index] if expected_argument.respond_to?(:wildcard_match?) return false unless expected_argument.wildcard_match?(arg) else return false unless expected_argument == arg end end return true end |