Sha256: 9520cf90e7fcf1f5119bd213000a9a2e47a36815ecfc6ac32582ea2cd01ed0c6

Contents?: true

Size: 882 Bytes

Versions: 25

Compression:

Stored size: 882 Bytes

Contents

module RR
  module Expectations
    class ArgumentEqualityExpectation
      attr_reader :expected_arguments

      def initialize(*expected_arguments)
        @expected_arguments = expected_arguments
      end

      def exact_match?(*arguments)
        @expected_arguments == arguments
      end

      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

      def ==(other)
        @expected_arguments == other.expected_arguments
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rr-0.1.12 lib/rr/expectations/argument_equality_expectation.rb
rr-0.1.10 lib/rr/expectations/argument_equality_expectation.rb
rr-0.1.14 lib/rr/expectations/argument_equality_expectation.rb
rr-0.1.15 lib/rr/expectations/argument_equality_expectation.rb
rr-0.1.11 lib/rr/expectations/argument_equality_expectation.rb
rr-0.1.13 lib/rr/expectations/argument_equality_expectation.rb
rr-0.1.8 lib/rr/expectations/argument_equality_expectation.rb
rr-0.3.2 lib/rr/expectations/argument_equality_expectation.rb
rr-0.1.9 lib/rr/expectations/argument_equality_expectation.rb
rr-0.3.1 lib/rr/expectations/argument_equality_expectation.rb
rr-0.2.4 lib/rr/expectations/argument_equality_expectation.rb
rr-0.3.3 lib/rr/expectations/argument_equality_expectation.rb
rr-0.2.2 lib/rr/expectations/argument_equality_expectation.rb
rr-0.2.5 lib/rr/expectations/argument_equality_expectation.rb
rr-0.3.10 lib/rr/expectations/argument_equality_expectation.rb
rr-0.3.4 lib/rr/expectations/argument_equality_expectation.rb
rr-0.2.3 lib/rr/expectations/argument_equality_expectation.rb
rr-0.2.1 lib/rr/expectations/argument_equality_expectation.rb
rr-0.3.0 lib/rr/expectations/argument_equality_expectation.rb
rr-0.3.11 lib/rr/expectations/argument_equality_expectation.rb