webmock 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/.gitignore +4 -1
  2. data/CHANGELOG.md +46 -0
  3. data/README.md +11 -1
  4. data/lib/webmock/config.rb +6 -0
  5. data/lib/webmock/errors.rb +9 -7
  6. data/lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb +23 -7
  7. data/lib/webmock/http_lib_adapters/excon_adapter.rb +4 -4
  8. data/lib/webmock/http_lib_adapters/http_gem/response.rb +3 -2
  9. data/lib/webmock/http_lib_adapters/http_gem/webmock.rb +1 -1
  10. data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +4 -4
  11. data/lib/webmock/matchers/hash_including_matcher.rb +1 -1
  12. data/lib/webmock/request_pattern.rb +11 -10
  13. data/lib/webmock/request_signature.rb +1 -1
  14. data/lib/webmock/request_stub.rb +1 -1
  15. data/lib/webmock/util/hash_keys_stringifier.rb +5 -3
  16. data/lib/webmock/util/query_mapper.rb +226 -146
  17. data/lib/webmock/util/uri.rb +4 -3
  18. data/lib/webmock/version.rb +1 -1
  19. data/lib/webmock/webmock.rb +12 -0
  20. data/spec/acceptance/em_http_request/em_http_request_spec.rb +73 -0
  21. data/spec/acceptance/excon/excon_spec.rb +15 -5
  22. data/spec/acceptance/http_gem/http_gem_spec.rb +9 -0
  23. data/spec/acceptance/httpclient/httpclient_spec.rb +11 -3
  24. data/spec/acceptance/httpclient/httpclient_spec_helper.rb +1 -1
  25. data/spec/acceptance/patron/patron_spec_helper.rb +1 -0
  26. data/spec/acceptance/shared/request_expectations.rb +18 -0
  27. data/spec/acceptance/shared/stubbing_requests.rb +5 -0
  28. data/spec/unit/errors_spec.rb +53 -15
  29. data/spec/unit/request_pattern_spec.rb +15 -0
  30. data/spec/unit/request_signature_spec.rb +3 -0
  31. data/spec/unit/util/hash_keys_stringifier_spec.rb +1 -1
  32. data/spec/unit/util/query_mapper_spec.rb +91 -17
  33. data/spec/unit/util/uri_spec.rb +29 -0
  34. data/webmock.gemspec +2 -2
  35. metadata +7 -15
@@ -197,6 +197,35 @@ describe WebMock::Util::URI do
197
197
  uri = WebMock::Util::URI.normalize_uri(uri_string)
198
198
  WebMock::Util::QueryMapper.query_to_values(uri.query).should == {"load"=>{"include"=>[{"staff"=>"email"},"business_name"]}}
199
199
  end
200
+
201
+ context "when query notation is set to :flat_array" do
202
+ before :all do
203
+ WebMock::Config.instance.query_values_notation = :flat_array
204
+ end
205
+
206
+ it "should successfully handle repeated paramters" do
207
+ uri_string = "http://www.example.com:80/path?target=host1&target=host2"
208
+ uri = WebMock::Util::URI.normalize_uri(uri_string)
209
+ WebMock::Util::QueryMapper.query_to_values(uri.query, :notation => WebMock::Config.instance.query_values_notation).should == [['target', 'host1'], ['target', 'host2']]
210
+ end
211
+ end
212
+ end
213
+
214
+ describe "sorting query values" do
215
+
216
+ context "when query values is a Hash" do
217
+ it "returns an alphabetically sorted hash" do
218
+ sorted_query = WebMock::Util::URI.sort_query_values({"b"=>"one", "a"=>"two"})
219
+ sorted_query.should == {"a"=>"two", "b"=>"one"}
220
+ end
221
+ end
222
+
223
+ context "when query values is an Array" do
224
+ it "returns an alphabetically sorted array" do
225
+ sorted_query = WebMock::Util::URI.sort_query_values([["b","two"],["a","one_b"],["a","one_a"]])
226
+ sorted_query.should == [["a","one_a"],["a","one_b"],["b","two"]]
227
+ end
228
+ end
200
229
  end
201
230
 
202
231
  describe "stripping default port" do
@@ -19,14 +19,14 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency 'crack', '>=0.3.2'
20
20
 
21
21
  s.add_development_dependency 'rspec', '~> 2.10'
22
- s.add_development_dependency 'http', '>= 0.5.0'
22
+ s.add_development_dependency 'http', '>= 0.6.0'
23
23
  s.add_development_dependency 'httpclient', '>= 2.2.4'
24
24
  s.add_development_dependency 'patron', '>= 0.4.18' unless RUBY_PLATFORM =~ /java/
25
25
  s.add_development_dependency 'em-http-request', '>= 1.0.2'
26
26
  s.add_development_dependency 'em-synchrony', '>= 1.0.0' if RUBY_VERSION >= "1.9"
27
27
  s.add_development_dependency 'curb', '>= 0.8.0' unless RUBY_PLATFORM =~ /java/
28
28
  s.add_development_dependency 'typhoeus', '>= 0.5.0' unless RUBY_PLATFORM =~ /java/
29
- s.add_development_dependency 'excon', '>= 0.27.5', '< 0.30.0'
29
+ s.add_development_dependency 'excon', '>= 0.27.5'
30
30
  s.add_development_dependency 'minitest', '~> 5.0.0'
31
31
  s.add_development_dependency 'rdoc', ((RUBY_VERSION == '1.8.6') ? '<= 3.5.0' : '>3.5.0')
32
32
 
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: 95
4
+ hash: 91
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 18
8
+ - 19
9
9
  - 0
10
- version: 1.18.0
10
+ version: 1.19.0
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: 2014-05-13 00:00:00 +02:00
18
+ date: 2014-09-28 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -72,12 +72,12 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- hash: 11
75
+ hash: 7
76
76
  segments:
77
77
  - 0
78
- - 5
78
+ - 6
79
79
  - 0
80
- version: 0.5.0
80
+ version: 0.6.0
81
81
  prerelease: false
82
82
  requirement: *id004
83
83
  name: http
@@ -174,14 +174,6 @@ dependencies:
174
174
  - 27
175
175
  - 5
176
176
  version: 0.27.5
177
- - - <
178
- - !ruby/object:Gem::Version
179
- hash: 103
180
- segments:
181
- - 0
182
- - 30
183
- - 0
184
- version: 0.30.0
185
177
  prerelease: false
186
178
  requirement: *id010
187
179
  name: excon