webmock-twirp 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 944a35bac7c3e752f543bc37f6d2b0a66a1a7f771022ac28c9c30ddba2e92891
4
- data.tar.gz: db6bfad348186e05d483d6d09c485fd470679e3978fcca131e93d5fcee6649de
3
+ metadata.gz: 0264d26c4984559b4163ff5740fda0df43882736fa174881a63939c195e85331
4
+ data.tar.gz: 9d0da633242e3f722d18c0c97042c5312b16ba4fb28fb6509479a04f5c4201eb
5
5
  SHA512:
6
- metadata.gz: 7b7fb99d4bf12cad35620ef9bb22bd7faabd626254c6e5a307b27da7478091eaf88256d0fc902cb507311312837c52ecc0b238796cedc0153674dbb34db69308
7
- data.tar.gz: 8f4bf9c6f3b828843e2cc8167c4b47e7ccda55a56dda1c678f5b1cf7e2b0eba01207e71572d08e13004e7c031f5ef950160f61a907ffffefbbec862be7d1918b
6
+ metadata.gz: 369e27e257599a09541feb244e9a4c1ff59a7b069c3df154c361c6567ce8f15f0e3b46cbfb0252ebe7c72beed20cb31bb8c947857d84372aec7ae3d697e21602
7
+ data.tar.gz: 7aa1544321a07d5f8350203f16f331d2e9ee90b5b38928d29d1b4fb2750101109298796ff7b571684108af8aaf3c80d4b2d595a27cdef0b33715c888cb99f1cd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### v0.1.2 (2022-10-17)
2
+ - improved matching
3
+ - test coverage
4
+
1
5
  ### v0.1.1 (2022-10-11)
2
6
  - test coverage
3
7
  - error messages
@@ -6,6 +6,15 @@ module WebMock
6
6
  find(&block)&.tap { |x| delete(x) }
7
7
  end
8
8
  end
9
+
10
+ refine Google::Protobuf::MessageExts do
11
+ def normalized_hash(symbolize_keys: true)
12
+ JSON.parse(
13
+ to_json(preserve_proto_fieldnames: true),
14
+ symbolize_names: symbolize_keys,
15
+ )
16
+ end
17
+ end
9
18
  end
10
19
  end
11
20
  end
@@ -76,10 +76,17 @@ module WebMock
76
76
  decoded_request = input_class.decode(request.body)
77
77
 
78
78
  if attrs.any?
79
- attr_matcher = Matchers::HashIncludingMatcher.new(**attrs)
80
- attr_hash = WebMock::Util::HashKeysStringifier.stringify_keys!(decoded_request.to_h, deep: true)
79
+ if defined?(RSpec::Matchers::BuiltIn::Include)
80
+ matcher = RSpec::Matchers::BuiltIn::Include.new(attrs)
81
+ attr_hash = decoded_request.to_h
82
+ normalize = ->{ decoded_request.normalized_hash }
83
+ else
84
+ matcher = WebMock::Matchers::HashIncludingMatcher.new(attrs)
85
+ attr_hash = WebMock::Util::HashKeysStringifier.stringify_keys!(decoded_request.to_h, deep: true)
86
+ normalize = ->{ decoded_request.normalized_hash(symbolize_keys: false) }
87
+ end
81
88
 
82
- matched &= attr_matcher === attr_hash
89
+ matched &= (matcher === attr_hash || matcher === normalize.call)
83
90
  end
84
91
 
85
92
  if block
@@ -1,5 +1,5 @@
1
1
  module WebMock
2
2
  module Twirp
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock-twirp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Pepper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-11 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webmock