webmock 3.9.0 → 3.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/lib/webmock/request_pattern.rb +6 -4
- data/lib/webmock/version.rb +1 -1
- data/spec/unit/request_pattern_spec.rb +44 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57c2c81fa3eb74334f703d9f92eb11cea8b06f1c70b713fdee1a071a90e99744
|
4
|
+
data.tar.gz: 96798ebd031599d59d06ff8d2457af877ba6d4a7e9d20ef9e464396c9104bc2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6f0e72a1ecc925a006b9f781cb2e873a8dcafef0a6b80be74df2ad34bdb3eba0a9d02571f72fa825321da86d2a0afdbbdfb4b56e7c3b280bc1643b2acd76100
|
7
|
+
data.tar.gz: 123fdca940fe7ea90b015cb6b085a063a00becef933df84335d1cf762780c12066590ab943c4cd5eba91bba4603f3663d4e8532ca374c036f5c0f306de03e28f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1136,6 +1136,7 @@ People who submitted patches and new features or suggested improvements. Many th
|
|
1136
1136
|
* Andrew Stuntz
|
1137
1137
|
* Lucas Uyezu
|
1138
1138
|
* Bruno Sutic
|
1139
|
+
* Ryan Kerr
|
1139
1140
|
|
1140
1141
|
For a full list of contributors you can visit the
|
1141
1142
|
[contributors](https://github.com/bblimke/webmock/contributors) page.
|
@@ -109,11 +109,13 @@ module WebMock
|
|
109
109
|
include RSpecMatcherDetector
|
110
110
|
|
111
111
|
def initialize(pattern)
|
112
|
-
@pattern =
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
@pattern = if pattern.is_a?(Addressable::URI) \
|
113
|
+
|| pattern.is_a?(Addressable::Template)
|
114
|
+
pattern
|
115
|
+
elsif pattern.respond_to?(:call)
|
116
116
|
pattern
|
117
|
+
else
|
118
|
+
WebMock::Util::URI.normalize_uri(pattern)
|
117
119
|
end
|
118
120
|
@query_params = nil
|
119
121
|
end
|
data/lib/webmock/version.rb
CHANGED
@@ -111,6 +111,11 @@ describe WebMock::RequestPattern do
|
|
111
111
|
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
112
112
|
end
|
113
113
|
|
114
|
+
it "should match if uri matches requesst uri as URI object" do
|
115
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"))).
|
116
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
117
|
+
end
|
118
|
+
|
114
119
|
it "should match if uri proc pattern returning true" do
|
115
120
|
expect(WebMock::RequestPattern.new(:get, ->(uri) { true })).
|
116
121
|
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
@@ -233,7 +238,7 @@ describe WebMock::RequestPattern do
|
|
233
238
|
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
234
239
|
end
|
235
240
|
|
236
|
-
it "should match request query params if params don't match" do
|
241
|
+
it "should not match request query params if params don't match" do
|
237
242
|
expect(WebMock::RequestPattern.new(:get, /.*example.*/, query: {"x" => ["b", "c"]})).
|
238
243
|
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
239
244
|
end
|
@@ -263,13 +268,49 @@ describe WebMock::RequestPattern do
|
|
263
268
|
end
|
264
269
|
end
|
265
270
|
|
271
|
+
describe "when uri is described as URI" do
|
272
|
+
it "should match request query params" do
|
273
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"), query: {"a" => ["b", "c"]})).
|
274
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
275
|
+
end
|
276
|
+
|
277
|
+
it "should not match request query params if params don't match" do
|
278
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"), query: {"x" => ["b", "c"]})).
|
279
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
280
|
+
end
|
281
|
+
|
282
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
283
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
284
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
285
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
289
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
290
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]}))).
|
291
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
295
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
296
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
297
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
301
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
302
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]}))).
|
303
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
266
307
|
describe "when uri is described as a proc" do
|
267
308
|
it "should match request query params" do
|
268
309
|
expect(WebMock::RequestPattern.new(:get, ->(uri) { true }, query: {"a" => ["b", "c"]})).
|
269
310
|
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
270
311
|
end
|
271
312
|
|
272
|
-
it "should match request query params if params don't match" do
|
313
|
+
it "should not match request query params if params don't match" do
|
273
314
|
expect(WebMock::RequestPattern.new(:get, ->(uri) { true }, query: {"x" => ["b", "c"]})).
|
274
315
|
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
275
316
|
end
|
@@ -305,7 +346,7 @@ describe WebMock::RequestPattern do
|
|
305
346
|
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
306
347
|
end
|
307
348
|
|
308
|
-
it "should match request query params if params don't match" do
|
349
|
+
it "should not match request query params if params don't match" do
|
309
350
|
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"), query: {"x" => ["b", "c"]})).
|
310
351
|
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
311
352
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.9.
|
4
|
+
version: 3.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartosz Blimke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -407,9 +407,9 @@ licenses:
|
|
407
407
|
- MIT
|
408
408
|
metadata:
|
409
409
|
bug_tracker_uri: https://github.com/bblimke/webmock/issues
|
410
|
-
changelog_uri: https://github.com/bblimke/webmock/blob/v3.9.
|
411
|
-
documentation_uri: https://www.rubydoc.info/gems/webmock/3.9.
|
412
|
-
source_code_uri: https://github.com/bblimke/webmock/tree/v3.9.
|
410
|
+
changelog_uri: https://github.com/bblimke/webmock/blob/v3.9.1/CHANGELOG.md
|
411
|
+
documentation_uri: https://www.rubydoc.info/gems/webmock/3.9.1
|
412
|
+
source_code_uri: https://github.com/bblimke/webmock/tree/v3.9.1
|
413
413
|
wiki_uri: https://github.com/bblimke/webmock/wiki
|
414
414
|
post_install_message:
|
415
415
|
rdoc_options: []
|