webmock 3.8.2 → 3.8.3

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: e810298e20d5299b4db93de105d6bfd2928db868ed70d6113e1e308091130f7c
4
- data.tar.gz: d35d0053907cb949df0a891e9b9e6e4f2c62143651fc2b19a2d02192fb1d6f91
3
+ metadata.gz: 0c101b3661b9aeb49e30e85da73705637944747d62eef4d463a9c30866431b10
4
+ data.tar.gz: 3c2a7ae9e28143b97b83c5a93cc14950748dc68969790d80f0d62a28600d7a5a
5
5
  SHA512:
6
- metadata.gz: f42ea1b65f3203df24d0dc5cf39204274c30339eb8831bc95570da25cc497cb51bb9cc696636a437b941aea050940574d01c6632dbe9db29bd67f67eab2e15d9
7
- data.tar.gz: 902b36dd0712ecafe4e26eca7416e6444638ea2687a86b434382428a6158c6b7a9155b17b62c30755712cc5cf51985482b6d7c386461d11ed5ade0afa069b45c
6
+ metadata.gz: 60174ed92a21c2f304d29e4d00edb7447eae871b37ddc2bb6b0a4704bf42492c9632913cee2c040644e6decc95242f39bf32728fe0df3b34d936cc9f78a42f2f
7
+ data.tar.gz: e7c4dc5363ec3f8028852b1d2173b214742bc03ca2ee25599a6d38d8c3a291f517890168dc74a69cd4f90f3f840e94fdd857941ab853a833ae5d77bc8282e464
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.8.3
4
+
5
+ * Fixed problem introduced in version 3.4.2, which caused matching against Addressable::Template representing host part of the URI to raise an error.
6
+
7
+ Thanks to [Vesa Laakso](https://github.com/valscion)
8
+
3
9
  ## 3.8.2
4
10
 
5
11
  * Support correct encoding parameter for HTTP.rb 2.x and earlier
data/README.md CHANGED
@@ -1120,6 +1120,7 @@ People who submitted patches and new features or suggested improvements. Many th
1120
1120
  * Samuel Williams
1121
1121
  * Patrik Ragnarsson
1122
1122
  * Alex Coomans
1123
+ * Vesa Laakso
1123
1124
 
1124
1125
  For a full list of contributors you can visit the
1125
1126
  [contributors](https://github.com/bblimke/webmock/contributors) page.
@@ -181,9 +181,13 @@ module WebMock
181
181
  private
182
182
 
183
183
  def matches_with_variations?(uri)
184
- normalized_template = Addressable::Template.new(WebMock::Util::URI.heuristic_parse(@pattern.pattern))
185
-
186
- WebMock::Util::URI.variations_of_uri_as_strings(uri).any? { |u| normalized_template.match(u) }
184
+ template =
185
+ begin
186
+ Addressable::Template.new(WebMock::Util::URI.heuristic_parse(@pattern.pattern))
187
+ rescue Addressable::URI::InvalidURIError
188
+ Addressable::Template.new(@pattern.pattern)
189
+ end
190
+ WebMock::Util::URI.variations_of_uri_as_strings(uri).any? { |u| template.match(u) }
187
191
  end
188
192
  end
189
193
 
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '3.8.2' unless defined?(::WebMock::VERSION)
2
+ VERSION = '3.8.3' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -132,6 +132,18 @@ describe WebMock::RequestPattern do
132
132
  expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
133
133
  end
134
134
 
135
+ it "should match if Addressable::Template pattern host matches request uri" do
136
+ signature = WebMock::RequestSignature.new(:get, "www.example.com")
137
+ uri = Addressable::Template.new("{subdomain}.example.com")
138
+ expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
139
+ end
140
+
141
+ it "should not match if Addressable::Template pattern host does not match request uri" do
142
+ signature = WebMock::RequestSignature.new(:get, "www.bad-example.com")
143
+ uri = Addressable::Template.new("{subdomain}.example.com")
144
+ expect(WebMock::RequestPattern.new(:get, uri)).not_to match(signature)
145
+ end
146
+
135
147
  it "should match for uris with same parameters as pattern" do
136
148
  expect(WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2")).
137
149
  to match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
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.8.2
4
+ version: 3.8.3
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-02-12 00:00:00.000000000 Z
11
+ date: 2020-03-11 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.8.2/CHANGELOG.md
411
- documentation_uri: https://www.rubydoc.info/gems/webmock/3.8.2
412
- source_code_uri: https://github.com/bblimke/webmock/tree/v3.8.2
410
+ changelog_uri: https://github.com/bblimke/webmock/blob/v3.8.3/CHANGELOG.md
411
+ documentation_uri: https://www.rubydoc.info/gems/webmock/3.8.3
412
+ source_code_uri: https://github.com/bblimke/webmock/tree/v3.8.3
413
413
  wiki_uri: https://github.com/bblimke/webmock/wiki
414
414
  post_install_message:
415
415
  rdoc_options: []