Sha256: 6668e45fa0e9bea3c8c755b613ceec40394432b7d1be0b2297e03c1cfee22980

Contents?: true

Size: 909 Bytes

Versions: 36

Compression:

Stored size: 909 Bytes

Contents

module WebMock
  module Matchers
    #this is a based on RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher
    #https://github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb
    class HashIncludingMatcher
      def initialize(expected)
        @expected = Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(expected, deep: true).sort]
      end

      def ==(actual)
        @expected.all? {|k,v| actual.has_key?(k) && v === actual[k]}
      rescue NoMethodError
        false
      end

      def inspect
        "hash_including(#{@expected.inspect})"
      end

      def self.from_rspec_matcher(matcher)
        new(matcher.instance_variable_get(:@expected))
      end
    end

    #this is a based on RSpec::Mocks::ArgumentMatchers::AnyArgMatcher
    class AnyArgMatcher
      def initialize(ignore)
      end

      def ==(other)
        true
      end
    end

  end
end

Version data entries

36 entries across 30 versions & 4 rubygems

Version Path
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb