webmock 1.24.3 → 1.24.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,18 @@
1
1
  # Changelog
2
2
 
3
- ## 1.24.3
4
-
5
- * Allow Net:HTTP headers keys to be provided as symbols if `RUBY_VERSION` >= 2.3.0
6
-
7
- Thanks to [Alex Kestner](https://github.com/akestner)
3
+ ## 1.24.4
8
4
 
9
5
  * Fixed the issue with parsing query to a hash with nested array i.e. `a[][b][]=one&a[][c][]=two`
10
6
 
11
7
  Thanks to [Tim Diggins](https://github.com/timdiggins) for reporting the issue.
12
8
  Thanks to [Cedric Pimenta](https://github.com/cedricpim) for finding the solution.
13
9
 
10
+ ## 1.24.3
11
+
12
+ * Allow Net:HTTP headers keys to be provided as symbols if `RUBY_VERSION` >= 2.3.0
13
+
14
+ Thanks to [Alex Kestner](https://github.com/akestner)
15
+
14
16
  * Added a clear message on an attept to match a multipart encoded request body.
15
17
  WebMock does't support requests with multipart body... yet.
16
18
 
data/Gemfile CHANGED
@@ -17,5 +17,3 @@ end
17
17
  platforms :jruby do
18
18
  gem 'jruby-openssl'
19
19
  end
20
-
21
- gem 'curb', '< 0.9.2' unless RUBY_PLATFORM =~ /java/ #https://github.com/taf2/curb/issues/296
data/README.md CHANGED
@@ -95,6 +95,10 @@ require 'webmock'
95
95
  include WebMock::API
96
96
  ```
97
97
 
98
+ ### Automatically enabled
99
+
100
+ `require 'webmock'` loads the library AND enables `WebMock`. Add `WebMock.disable!` after loading the gem to disable this behavior.
101
+
98
102
  ## Examples
99
103
 
100
104
 
@@ -4,6 +4,8 @@ source "http://rubygems.org/"
4
4
 
5
5
  gem "addressable", ">= 2.3.6", "< 2.4.0"
6
6
 
7
+ gem "curb", "< 0.9.2"
8
+
7
9
  group :development do
8
10
  gem "rake", '~> 10.5.0'
9
11
  end
@@ -17,5 +19,3 @@ platforms :jruby do
17
19
  end
18
20
 
19
21
  gemspec :path => "../"
20
-
21
- gem 'curb', '< 0.9.2' unless RUBY_PLATFORM =~ /java/ #https://github.com/taf2/curb/issues/296
@@ -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 = '1.24.3' unless defined?(::WebMock::VERSION)
2
+ VERSION = '1.24.4' unless defined?(::WebMock::VERSION)
3
3
  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
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: 113
4
+ hash: 127
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 24
9
- - 3
10
- version: 1.24.3
9
+ - 4
10
+ version: 1.24.4
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: 2016-04-13 00:00:00 +02:00
18
+ date: 2016-04-20 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency