webmock-twirp 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +51 -27
- data/lib/webmock/twirp/request_stub.rb +30 -16
- data/lib/webmock/twirp/version.rb +1 -1
- data/webmock-twirp.gemspec +1 -1
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d2e3419ce5ddc60c10c14e7cb33e806b6ee92c0f93787b5209a0e3eeb47638e
|
4
|
+
data.tar.gz: 84b5215a00b57a531f24fde3298b0720bba7de7fd0553523af3ac3bd3df83cbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59acbce84012d937a66f6fe601a2ec0b49f9a56c384113c35371362b603907f201dea384f54e343e8759b9b397c732f8c03e185d2a72ab88f7bfb33ba5e3fa4b
|
7
|
+
data.tar.gz: 536a0a49c744b98d3973e56c18e02ec0e968f14f71639ee4164808b6a07f545a6df416ee1b7e36b11bf877e8febad5163b634fe10a4d7fc3bfe9ddf6c1624f52
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,67 +1,91 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
webmock-twirp (0.
|
4
|
+
webmock-twirp (0.6.0)
|
5
5
|
twirp (>= 1)
|
6
6
|
webmock (>= 3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.8.
|
12
|
-
public_suffix (>= 2.0.2, <
|
13
|
-
|
14
|
-
bigdecimal (3.1.6)
|
15
|
-
byebug (11.1.3)
|
11
|
+
addressable (2.8.7)
|
12
|
+
public_suffix (>= 2.0.2, < 7.0)
|
13
|
+
bigdecimal (3.1.9)
|
16
14
|
crack (1.0.0)
|
17
15
|
bigdecimal
|
18
16
|
rexml
|
17
|
+
date (3.4.1)
|
18
|
+
debug (1.10.0)
|
19
|
+
irb (~> 1.10)
|
20
|
+
reline (>= 0.3.8)
|
19
21
|
diff-lcs (1.5.1)
|
20
|
-
docile (1.4.
|
21
|
-
faraday (2.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
faraday-net_http (3.0
|
22
|
+
docile (1.4.1)
|
23
|
+
faraday (2.12.1)
|
24
|
+
faraday-net_http (>= 2.0, < 3.5)
|
25
|
+
json
|
26
|
+
logger
|
27
|
+
faraday-net_http (3.4.0)
|
28
|
+
net-http (>= 0.5.0)
|
26
29
|
google-protobuf (3.25.3)
|
27
|
-
hashdiff (1.1.
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
hashdiff (1.1.2)
|
31
|
+
io-console (0.8.0)
|
32
|
+
irb (1.15.1)
|
33
|
+
pp (>= 0.6.0)
|
34
|
+
rdoc (>= 4.0.0)
|
35
|
+
reline (>= 0.4.2)
|
36
|
+
json (2.9.0)
|
37
|
+
logger (1.6.2)
|
38
|
+
net-http (0.6.0)
|
39
|
+
uri
|
40
|
+
pp (0.6.2)
|
41
|
+
prettyprint
|
42
|
+
prettyprint (0.2.0)
|
43
|
+
psych (5.2.3)
|
44
|
+
date
|
45
|
+
stringio
|
46
|
+
public_suffix (6.0.1)
|
47
|
+
rack (3.1.9)
|
48
|
+
rdoc (6.12.0)
|
49
|
+
psych (>= 4.0.0)
|
50
|
+
reline (0.6.0)
|
51
|
+
io-console (~> 0.5)
|
52
|
+
rexml (3.4.0)
|
31
53
|
rspec (3.13.0)
|
32
54
|
rspec-core (~> 3.13.0)
|
33
55
|
rspec-expectations (~> 3.13.0)
|
34
56
|
rspec-mocks (~> 3.13.0)
|
35
|
-
rspec-core (3.13.
|
57
|
+
rspec-core (3.13.2)
|
36
58
|
rspec-support (~> 3.13.0)
|
37
|
-
rspec-expectations (3.13.
|
59
|
+
rspec-expectations (3.13.3)
|
38
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
39
61
|
rspec-support (~> 3.13.0)
|
40
|
-
rspec-mocks (3.13.
|
62
|
+
rspec-mocks (3.13.2)
|
41
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
64
|
rspec-support (~> 3.13.0)
|
43
|
-
rspec-support (3.13.
|
44
|
-
ruby2_keywords (0.0.5)
|
65
|
+
rspec-support (3.13.2)
|
45
66
|
simplecov (0.22.0)
|
46
67
|
docile (~> 1.1)
|
47
68
|
simplecov-html (~> 0.11)
|
48
69
|
simplecov_json_formatter (~> 0.1)
|
49
|
-
simplecov-html (0.
|
70
|
+
simplecov-html (0.13.1)
|
50
71
|
simplecov_json_formatter (0.1.4)
|
51
|
-
|
72
|
+
stringio (3.1.2)
|
73
|
+
twirp (1.13.0)
|
52
74
|
faraday (< 3)
|
53
|
-
google-protobuf (
|
54
|
-
|
75
|
+
google-protobuf (>= 3.25, < 5.a)
|
76
|
+
rack (>= 2.2.3)
|
77
|
+
uri (1.0.2)
|
78
|
+
webmock (3.25.0)
|
55
79
|
addressable (>= 2.8.0)
|
56
80
|
crack (>= 0.3.2)
|
57
81
|
hashdiff (>= 0.4.0, < 2.0.0)
|
58
|
-
webrick (1.
|
82
|
+
webrick (1.9.1)
|
59
83
|
|
60
84
|
PLATFORMS
|
61
85
|
ruby
|
62
86
|
|
63
87
|
DEPENDENCIES
|
64
|
-
|
88
|
+
debug
|
65
89
|
rack
|
66
90
|
rspec
|
67
91
|
simplecov
|
@@ -61,14 +61,7 @@ module WebMock
|
|
61
61
|
# match rpc dynamically after client resolves
|
62
62
|
@rpc_name = rpc_name
|
63
63
|
|
64
|
-
|
65
|
-
rpc_info = request.twirp_rpc
|
66
|
-
|
67
|
-
!!rpc_info && (
|
68
|
-
rpc_info[:rpc_method] == rpc_name ||
|
69
|
-
rpc_info[:ruby_method] == rpc_name
|
70
|
-
)
|
71
|
-
end
|
64
|
+
with
|
72
65
|
end
|
73
66
|
end
|
74
67
|
|
@@ -84,11 +77,20 @@ module WebMock
|
|
84
77
|
end
|
85
78
|
|
86
79
|
request_matcher = if request
|
87
|
-
|
88
|
-
|
80
|
+
if request.is_a?(Google::Protobuf::MessageExts)
|
81
|
+
# match message type and contents
|
82
|
+
# RSpec::Matchers::BuiltIn::Eq.new(request)
|
83
|
+
->(expected, actual) { actual == expected }.curry.call(request)
|
84
|
+
elsif request.is_a?(Class) && request < Google::Protobuf::MessageExts
|
85
|
+
# match message type
|
86
|
+
# RSpec::Matchers::BuiltIn::BeAKindOf.new(request)
|
87
|
+
->(expected, actual) { actual.is_a?(expected) }.curry.call(request)
|
88
|
+
elsif request.respond_to?(:matches?)
|
89
|
+
# is_a?(RSpec::Matchers::BuiltIn::BaseMatcher)
|
90
|
+
->(expected, actual) { expected.matches?(actual) }.curry.call(request)
|
91
|
+
else
|
92
|
+
raise TypeError, "Expected request to be a Protobuf::MessageExts, found: #{request}"
|
89
93
|
end
|
90
|
-
|
91
|
-
{ body: request.to_proto }
|
92
94
|
end
|
93
95
|
|
94
96
|
# save for diffing
|
@@ -100,12 +102,26 @@ module WebMock
|
|
100
102
|
attrs
|
101
103
|
end
|
102
104
|
|
103
|
-
|
105
|
+
super() do |request_signature|
|
104
106
|
matched = true
|
105
107
|
|
106
108
|
request = request_signature.twirp_request
|
107
109
|
matched &&= !!request
|
108
110
|
|
111
|
+
if request_matcher
|
112
|
+
matched &&= request_matcher.call(request)
|
113
|
+
end
|
114
|
+
|
115
|
+
# match rpc_name
|
116
|
+
if @rpc_name
|
117
|
+
rpc_info = request_signature.twirp_rpc
|
118
|
+
|
119
|
+
matched &&= !!rpc_info && (
|
120
|
+
rpc_info[:rpc_method] == @rpc_name ||
|
121
|
+
rpc_info[:ruby_method] == @rpc_name
|
122
|
+
)
|
123
|
+
end
|
124
|
+
|
109
125
|
# match request attributes
|
110
126
|
if attrs.any?
|
111
127
|
matched &&= request.include?(attrs)
|
@@ -116,8 +132,6 @@ module WebMock
|
|
116
132
|
|
117
133
|
matched
|
118
134
|
end
|
119
|
-
|
120
|
-
super(request_matcher || {}, &decoder)
|
121
135
|
end
|
122
136
|
|
123
137
|
def to_return(*responses, &block)
|
@@ -195,7 +209,7 @@ module WebMock
|
|
195
209
|
|
196
210
|
obj.new
|
197
211
|
else
|
198
|
-
raise ArgumentError, "can not generate twirp
|
212
|
+
raise ArgumentError, "can not generate twirp response from: #{obj}"
|
199
213
|
end
|
200
214
|
|
201
215
|
if res.is_a?(Google::Protobuf::MessageExts)
|
data/webmock-twirp.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_dependency "webmock", ">= 3"
|
17
17
|
s.add_dependency "twirp", ">= 1"
|
18
18
|
|
19
|
-
s.add_development_dependency "
|
19
|
+
s.add_development_dependency "debug"
|
20
20
|
s.add_development_dependency "rack"
|
21
21
|
s.add_development_dependency "rspec"
|
22
22
|
s.add_development_dependency "simplecov"
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock-twirp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pepper
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-11 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: webmock
|
@@ -39,7 +38,7 @@ dependencies:
|
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '1'
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
41
|
+
name: debug
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - ">="
|
@@ -109,7 +108,6 @@ dependencies:
|
|
109
108
|
- !ruby/object:Gem::Version
|
110
109
|
version: '0'
|
111
110
|
description: Twirp support for WebMock
|
112
|
-
email:
|
113
111
|
executables: []
|
114
112
|
extensions: []
|
115
113
|
extra_rdoc_files: []
|
@@ -137,7 +135,6 @@ homepage: https://github.com/dpep/webmock-twirp
|
|
137
135
|
licenses:
|
138
136
|
- MIT
|
139
137
|
metadata: {}
|
140
|
-
post_install_message:
|
141
138
|
rdoc_options: []
|
142
139
|
require_paths:
|
143
140
|
- lib
|
@@ -152,8 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
149
|
- !ruby/object:Gem::Version
|
153
150
|
version: '0'
|
154
151
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
156
|
-
signing_key:
|
152
|
+
rubygems_version: 3.6.3
|
157
153
|
specification_version: 4
|
158
154
|
summary: WebMock::Twirp
|
159
155
|
test_files: []
|