webmock 2.0.0.beta1 → 2.0.0.beta2

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
  SHA1:
3
- metadata.gz: ff6dc7d940f08ae334e0220100267ab6a41a58e4
4
- data.tar.gz: 35dd3369af56b08b38fdf59f943c56b9552eb31e
3
+ metadata.gz: d21aa0e8add495ea18c8175f2933769eca451bd7
4
+ data.tar.gz: 1e3b282e39b2f1bbfdb1b1e5f2e3b3584dbbe4a7
5
5
  SHA512:
6
- metadata.gz: f8448b8a8a176d912a448912133bc68b0edfa37c136235821f938153a7ef421ac2a2218996de115676469c781668a1b70abf0740140b2a3751419b7b267762b0
7
- data.tar.gz: 389edffa68682edbf92649d0346073193abf5dd9d918249a3c6d381eecb5ae2954b01a739d803b467bbc65bf1438a82b30bb322c9796a93010b881ec28322dd1
6
+ metadata.gz: 604fc6873f4b8765a78f11811b344623cd7cc612843b74e38b9ad2c9b1c59ad30292fb47961669fdfe110a71143128137f66073d8075db73722e8c326ebac30c
7
+ data.tar.gz: 8f88979b836c0148e8c03a641246169b1bc5f9d00c8d9deee7cf603b1d94e2d9e54549d2ef4ead205a77cb13bb7b16763b75fd836d4b5ece2e501254df54fdd5
data/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 2.0.0
4
4
 
5
- * require 'webmock' does not enable WebMock anymore. `gem 'webmock'` can be now safely added to the Gemfile without modifying http clients. Call `WebMock.enable!` to enable it.
5
+ * `require 'webmock'` does not enable WebMock anymore. `gem 'webmock'` can be now safely added to a Gemfile without modifying http client libs. Call `WebMock.enable!` to enable WebMock.
6
6
 
7
7
  Please note that `require 'webmock/rspec'`, `require 'webmock/test_unit'`, `require 'webmock/minitest'` and `require 'webmock/cucumber'` still do enable WebMock.
8
8
 
@@ -10,8 +10,8 @@
10
10
 
11
11
  * Dropped support for em-http-request < 1.0.0
12
12
 
13
- * WebMock 2.0 does not match basic auth credentials in the userinfo part of the url, with credentials passed in `Authorization: Basic ...` header.
14
- It now treats the Authorization header and credentials in userinfo in the url as completely separate attributes of the request.
13
+ * WebMock 2.0 does not match basic authentication credentials in the userinfo part of the url, with credentials passed in `Authorization: Basic ...` header anymore.
14
+ It now treats the Authorization header and credentials in the userinfo part of a url as two completely separate attributes of a request.
15
15
 
16
16
  The following stub declaration, which used to work in WebMock 1.x, is not going to work anymore
17
17
 
@@ -32,24 +32,33 @@
32
32
  stub_request(:get, "www.example.com").
33
33
  with(headers: 'Authorization' => "Basic #{ Base64.encode64('user:pass').chomp}")
34
34
 
35
- In order to stub a request with basic authentication credentials provided in the url please use the following code:
35
+ In order to stub a request with basic authentication credentials provided in the url, please use the following code:
36
36
 
37
37
  stub_request(:get, "user:pass@www.example.com")
38
38
 
39
39
  RestClient.get('user:pass@www.example.com') # ===> Success
40
40
 
41
+ ## 1.24.6
41
42
 
42
- ## 1.24.3
43
+ * Fixed issue with RUBY_VERSION comparison using old RubyGems.
43
44
 
44
- * Allow Net:HTTP headers keys to be provided as symbols if `RUBY_VERSION` >= 2.3.0
45
+ Thanks to [Chris Griego](https://github.com/cgriego).
45
46
 
46
- Thanks to [Alex Kestner](https://github.com/akestner)
47
+ * Support for http.rb >= 2.0.0
48
+
49
+ ## 1.24.4
47
50
 
48
51
  * Fixed the issue with parsing query to a hash with nested array i.e. `a[][b][]=one&a[][c][]=two`
49
52
 
50
53
  Thanks to [Tim Diggins](https://github.com/timdiggins) for reporting the issue.
51
54
  Thanks to [Cedric Pimenta](https://github.com/cedricpim) for finding the solution.
52
55
 
56
+ ## 1.24.3
57
+
58
+ * Allow Net:HTTP headers keys to be provided as symbols if `RUBY_VERSION` >= 2.3.0
59
+
60
+ Thanks to [Alex Kestner](https://github.com/akestner)
61
+
53
62
  * Added a clear message on an attept to match a multipart encoded request body.
54
63
  WebMock does't support requests with multipart body... yet.
55
64
 
@@ -61,7 +70,6 @@
61
70
 
62
71
  Thanks to [Gabriel Chaney](https://github.com/gabrieljoelc) for reporting the issue.
63
72
 
64
-
65
73
  ## 1.24.2
66
74
 
67
75
  * Improve parsing of params on request
data/README.md CHANGED
@@ -1015,6 +1015,7 @@ People who submitted patches and new features or suggested improvements. Many th
1015
1015
  * Manfred Stienstra
1016
1016
  * Tim Diggins
1017
1017
  * Gabriel Chaney
1018
+ * Chris Griego
1018
1019
 
1019
1020
  For a full list of contributors you can visit the
1020
1021
  [contributors](https://github.com/bblimke/webmock/contributors) page.
@@ -33,7 +33,7 @@ module HTTP
33
33
  def normalize_uri(uri)
34
34
  return unless uri
35
35
 
36
- uri = URI.parse uri
36
+ uri = Addressable::URI.parse uri
37
37
  uri.port = nil if uri.default_port && uri.port == uri.default_port
38
38
 
39
39
  uri
@@ -306,7 +306,7 @@ module WebMock
306
306
  #
307
307
  # So before this point, WebMock raises an ArgumentError if any of the headers are symbols
308
308
  # instead of the cryptic NoMethodError "undefined method `split' ...` from Net::HTTP
309
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
309
+ if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.3.0')
310
310
  header_as_symbol = headers.keys.find {|header| header.is_a? Symbol}
311
311
  if header_as_symbol
312
312
  raise ArgumentError.new("Net:HTTP does not accept headers as symbols")
@@ -146,6 +146,7 @@ module WebMock::Util
146
146
  last_container = current_node.select { |n| n.is_a?(Hash) }.last
147
147
  if last_container && !last_container.has_key?(last_key)
148
148
  if array_value
149
+ last_container[last_key] ||= []
149
150
  last_container[last_key] << value
150
151
  else
151
152
  last_container[last_key] = value
@@ -159,7 +160,7 @@ module WebMock::Util
159
160
  end
160
161
  else
161
162
  if array_value
162
- current_node[last_key] = [] unless current_node[last_key]
163
+ current_node[last_key] ||= []
163
164
  current_node[last_key] << value
164
165
  else
165
166
  current_node[last_key] = value
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '2.0.0.beta1' unless defined?(::WebMock::VERSION)
2
+ VERSION = '2.0.0.beta2' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -132,7 +132,7 @@ describe "Net:HTTP" do
132
132
  end
133
133
  end
134
134
 
135
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
135
+ if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.3.0')
136
136
  expect do
137
137
  http.request(request)
138
138
  end.to raise_error ArgumentError, "Net:HTTP does not accept headers as symbols"
@@ -239,9 +239,9 @@ shared_context "allowing and disabling net connect" do |*adapter_info|
239
239
  end
240
240
 
241
241
  it "should make a real request if request is allowed by path regexp and url contains default port", :net_connect => true do
242
- WebMock.disable_net_connect!(:allow => %r{github.com/bblimke/webmock})
242
+ WebMock.disable_net_connect!(:allow => %r{www.google.pl/webhp})
243
243
  method = http_library == :httpclient ? :head : :get
244
- expect(http_request(method, 'https://github.com:443/bblimke/webmock').status).to eq('200')
244
+ expect(http_request(method, 'https://www.google.pl:443/webhp').status).to eq('200')
245
245
  end
246
246
  end
247
247
  end
@@ -48,6 +48,22 @@ describe WebMock::Util::QueryMapper do
48
48
  expect(hsh['a'][0]['b'][0]['c'][0]['d'][0]).to eq('1')
49
49
  expect(hsh['a'][0]['b'][0]['c'][0]['d'][1]['e']).to eq('2')
50
50
  end
51
+
52
+ it "should parse nested repeated correctly" do
53
+ query = "a[][b][]=one&a[][b][]=two"
54
+ hsh = subject.query_to_values(query)
55
+ expect(hsh['a']).to be_a(Array)
56
+ expect(hsh['a'][0]).to eq({"b" => ['one']})
57
+ expect(hsh['a'][1]).to eq({"b" => ['two']})
58
+ end
59
+
60
+ it "should parse nested non-repeated correctly" do
61
+ query = "a[][b][]=one&a[][c][]=two"
62
+ hsh = subject.query_to_values(query)
63
+ expect(hsh['a']).to be_a(Array)
64
+ expect(hsh['a'][0]['b']).to eq(['one'])
65
+ expect(hsh['a'][0]['c']).to eq(['two'])
66
+ end
51
67
  end
52
68
 
53
69
  context '#to_query' do
data/webmock.gemspec CHANGED
@@ -39,4 +39,6 @@ Gem::Specification.new do |s|
39
39
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
40
40
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
41
41
  s.require_paths = ['lib']
42
+
43
+ s.post_install_message = "WebMock 2.0 has some breaking changes. Please check the CHANGELOG: https://goo.gl/piDGLu"
42
44
  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: 2.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Blimke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -364,7 +364,8 @@ homepage: http://github.com/bblimke/webmock
364
364
  licenses:
365
365
  - MIT
366
366
  metadata: {}
367
- post_install_message:
367
+ post_install_message: 'WebMock 2.0 has some breaking changes. Please check the CHANGELOG:
368
+ https://goo.gl/piDGLu'
368
369
  rdoc_options: []
369
370
  require_paths:
370
371
  - lib