Class: RR::Expectations::ArgumentEqualityExpectation
- Inherits:
-
Object
- Object
- RR::Expectations::ArgumentEqualityExpectation
- Defined in:
- lib/rr/expectations/argument_equality_expectation.rb
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.
9 10 11 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 9 def initialize(*expected_arguments) @expected_arguments = expected_arguments end |
Instance Attribute Details
#expected_arguments ⇒ Object (readonly)
Returns the value of attribute expected_arguments.
7 8 9 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 7 def expected_arguments @expected_arguments end |
Instance Method Details
#==(other) ⇒ Object
30 31 32 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 30 def ==(other) @expected_arguments == other.expected_arguments end |
#exact_match?(*arguments) ⇒ Boolean
13 14 15 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 13 def exact_match?(*arguments) @expected_arguments == arguments end |
#wildcard_match?(*arguments) ⇒ Boolean
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rr/expectations/argument_equality_expectation.rb', line 17 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 |