webmock 1.12.1 → 1.12.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,10 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.12.2
4
+
5
+ * Fixed issue with handling request.path when Addressable::URI is passed to #request instead of URI with Ruby 2.0.
6
+
7
+ Thanks to [Leif Bladt](https://github.com/leifbladt)
8
+
9
+ * Accept integers as query param values in request stubs
10
+
11
+ i.e. `stub_request(:get, /.*/).with(:query => {"a" => 1})`
12
+
13
+ Thanks to [Mitsutaka Mimura](https://github.com/takkanm)
3
14
 
4
15
  ## 1.12.1
5
16
 
6
17
  * Fixed Minitest < 5.0 compatibility
7
18
 
19
+ Thanks to [Alex Tomlins](https://github.com/alext) for reporting the issue.
20
+
8
21
  ## 1.12.0
9
22
 
10
23
  * Not using Gem spec anymore to check loaded Curb version.
data/README.md CHANGED
@@ -847,6 +847,9 @@ People who submitted patches and new features or suggested improvements. Many th
847
847
  * Tim Kurvers
848
848
  * Ilya Vassilevsky
849
849
  * gotwalt
850
+ * Leif Bladt
851
+ * Alex Tomlins
852
+ * Mitsutaka Mimura
850
853
 
851
854
  For a full list of contributors you can visit the
852
855
  [contributors](https://github.com/bblimke/webmock/contributors) page.
@@ -235,7 +235,12 @@ module WebMock
235
235
  protocol = net_http.use_ssl? ? "https" : "http"
236
236
 
237
237
  path = request.path
238
- path = WebMock::Util::URI.heuristic_parse(request.path).request_uri if request.path =~ /^http/
238
+
239
+ if path.respond_to?(:path) #https://github.com/bblimke/webmock/issues/288
240
+ path = path.path
241
+ end
242
+
243
+ path = WebMock::Util::URI.heuristic_parse(path).request_uri if path =~ /^http/
239
244
 
240
245
  if request["authorization"] =~ /^Basic /
241
246
  userinfo = WebMock::Util::Headers.decode_userinfo_from_header(request["authorization"])
@@ -169,7 +169,7 @@ module WebMock::Util
169
169
  return parent
170
170
  else
171
171
  encoded_value = Addressable::URI.encode_component(
172
- value.dup, Addressable::URI::CharacterClasses::UNRESERVED
172
+ value.to_s.dup, Addressable::URI::CharacterClasses::UNRESERVED
173
173
  )
174
174
  return "#{parent}=#{encoded_value}"
175
175
  end
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '1.12.1' unless defined?(::WebMock::VERSION)
2
+ VERSION = '1.12.2' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -158,6 +158,11 @@ describe "Net:HTTP" do
158
158
  WebMock::RequestRegistry.instance.requested_signatures.hash.values.first.should == 1
159
159
  end
160
160
 
161
+ it "should work with Addressable::URI passed to Net::HTTP.get_response" do
162
+ stub_request(:get, 'http://www.example.com')
163
+ Net::HTTP.get_response(Addressable::URI.parse('http://www.example.com/'))
164
+ end
165
+
161
166
  describe "connecting on Net::HTTP.start" do
162
167
  before(:each) do
163
168
  @http = Net::HTTP.new('www.google.com', 443)
@@ -6,6 +6,11 @@ shared_examples_for "stubbing requests" do |*adapter_info|
6
6
  http_request(:get, "http://www.example.com/hello%2B/?#{ESCAPED_PARAMS}").body.should == "abc"
7
7
  end
8
8
 
9
+ it "should return stubbed response even if query params have integer values" do
10
+ stub_request(:get, "www.example.com").with(:query => {"a" => 1}).to_return(:body => "abc")
11
+ http_request(:get, "http://www.example.com/?a=1").body.should == "abc"
12
+ end
13
+
9
14
  it "should return stubbed response even if request has non escaped params" do
10
15
  stub_request(:get, "www.example.com/hello%2B/?#{ESCAPED_PARAMS}").to_return(:body => "abc")
11
16
  http_request(:get, "http://www.example.com/hello+/?#{NOT_ESCAPED_PARAMS}").body.should == "abc"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- hash: 37
4
+ hash: 35
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 12
9
- - 1
10
- version: 1.12.1
9
+ - 2
10
+ version: 1.12.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bartosz Blimke
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-06-26 00:00:00 Z
18
+ date: 2013-06-27 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: addressable