Sha256: 2b4612cd1bceafcfbd3bd588e7a188afe6f01ed5e3da52ece1aa50bee5685f89

Contents?: true

Size: 912 Bytes

Versions: 92

Compression:

Stored size: 912 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

92 entries across 90 versions & 9 rubygems

Version Path
docspring-3.0.0 vendor/bundle/ruby/3.3.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.16 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.15 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.14 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.13 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.12 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.11 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.10 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.9 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.8 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.7 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.6 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.5 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.4 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.3 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.2 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.1 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-2.0.0 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-1.142.3 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb
cloudsmith-api-1.120.3 vendor/bundle/ruby/2.6.0/gems/webmock-1.24.6/lib/webmock/matchers/hash_including_matcher.rb