webmock 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -7
- data/CHANGELOG.md +45 -0
- data/README.md +16 -2
- data/lib/webmock.rb +3 -0
- data/lib/webmock/api.rb +8 -0
- data/lib/webmock/http_lib_adapters/curb_adapter.rb +1 -1
- data/lib/webmock/http_lib_adapters/excon_adapter.rb +1 -1
- data/lib/webmock/http_lib_adapters/http_rb/request.rb +7 -1
- data/lib/webmock/http_lib_adapters/http_rb/streamer.rb +4 -0
- data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +1 -1
- data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +5 -3
- data/lib/webmock/http_lib_adapters/net_http.rb +2 -2
- data/lib/webmock/http_lib_adapters/patron_adapter.rb +2 -2
- data/lib/webmock/matchers/any_arg_matcher.rb +13 -0
- data/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
- data/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
- data/lib/webmock/matchers/hash_including_matcher.rb +4 -23
- data/lib/webmock/rack_response.rb +1 -1
- data/lib/webmock/request_execution_verifier.rb +2 -3
- data/lib/webmock/request_pattern.rb +9 -2
- data/lib/webmock/request_registry.rb +1 -1
- data/lib/webmock/request_signature.rb +1 -1
- data/lib/webmock/request_signature_snippet.rb +4 -4
- data/lib/webmock/stub_request_snippet.rb +2 -2
- data/lib/webmock/util/headers.rb +2 -2
- data/lib/webmock/util/query_mapper.rb +3 -3
- data/lib/webmock/version.rb +1 -1
- data/minitest/webmock_spec.rb +2 -2
- data/spec/acceptance/http_rb/http_rb_spec.rb +9 -0
- data/spec/acceptance/http_rb/http_rb_spec_helper.rb +1 -1
- data/spec/acceptance/httpclient/httpclient_spec.rb +8 -1
- data/spec/acceptance/net_http/net_http_shared.rb +1 -1
- data/spec/acceptance/net_http/net_http_spec.rb +15 -1
- data/spec/acceptance/patron/patron_spec_helper.rb +1 -1
- data/spec/acceptance/shared/request_expectations.rb +7 -0
- data/spec/acceptance/shared/stubbing_requests.rb +5 -0
- data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +1 -1
- data/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +1 -1
- data/spec/unit/api_spec.rb +84 -3
- data/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
- data/spec/unit/request_execution_verifier_spec.rb +12 -12
- data/test/shared_test.rb +15 -2
- metadata +44 -39
data/test/shared_test.rb
CHANGED
@@ -41,7 +41,7 @@ module SharedTest
|
|
41
41
|
|
42
42
|
def test_verification_that_expected_request_didnt_occur
|
43
43
|
expected_message = "The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times"
|
44
|
-
expected_message
|
44
|
+
expected_message += "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
|
45
45
|
assert_fail(expected_message) do
|
46
46
|
assert_requested(:get, "http://www.example.com")
|
47
47
|
end
|
@@ -49,7 +49,7 @@ module SharedTest
|
|
49
49
|
|
50
50
|
def test_verification_that_expected_stub_didnt_occur
|
51
51
|
expected_message = "The request ANY http://www.example.com/ was expected to execute 1 time but it executed 0 times"
|
52
|
-
expected_message
|
52
|
+
expected_message += "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
|
53
53
|
assert_fail(expected_message) do
|
54
54
|
assert_requested(@stub_http)
|
55
55
|
end
|
@@ -69,6 +69,19 @@ module SharedTest
|
|
69
69
|
query: hash_including({"a" => ["b", "c"]}))
|
70
70
|
end
|
71
71
|
|
72
|
+
def test_verification_that_expected_request_not_occured_with_query_params
|
73
|
+
stub_request(:any, 'http://www.example.com').with(query: hash_including(a: ['b', 'c']))
|
74
|
+
stub_request(:any, 'http://www.example.com').with(query: hash_excluding(a: ['b', 'c']))
|
75
|
+
http_request(:get, 'http://www.example.com/?a[]=b&a[]=c&x=1')
|
76
|
+
assert_not_requested(:get, 'http://www.example.com', query: hash_excluding('a' => ['b', 'c']))
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_verification_that_expected_request_occured_with_excluding_query_params
|
80
|
+
stub_request(:any, 'http://www.example.com').with(query: hash_excluding('a' => ['b', 'c']))
|
81
|
+
http_request(:get, 'http://www.example.com/?a[]=x&a[]=y&x=1')
|
82
|
+
assert_requested(:get, 'http://www.example.com', query: hash_excluding('a' => ['b', 'c']))
|
83
|
+
end
|
84
|
+
|
72
85
|
def test_verification_that_non_expected_request_didnt_occur
|
73
86
|
expected_message = %r(The request GET http://www.example.com/ was not expected to execute but it executed 1 time\n\nThe following requests were made:\n\nGET http://www.example.com/ with headers .+ was made 1 time\n\n============================================================)
|
74
87
|
assert_fail(expected_message) do
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartosz Blimke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.3.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.3.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: crack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.3.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.3.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hashdiff
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: patron
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.4.18
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.4.18
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: curb
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.7.16
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.7.16
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: typhoeus
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.5.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.5.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: http
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 0.8.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.8.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
@@ -126,112 +126,112 @@ dependencies:
|
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 3.1.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 3.1.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: httpclient
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: 2.2.4
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 2.2.4
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: em-http-request
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: 1.0.2
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 1.0.2
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: em-synchrony
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - '>='
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: 1.0.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - '>='
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: 1.0.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: excon
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - '>='
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: 0.27.5
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - '>='
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: 0.27.5
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: minitest
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - '>='
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: 5.0.0
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - '>='
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: 5.0.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: test-unit
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- -
|
213
|
+
- - '>='
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: 3.0.0
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- -
|
220
|
+
- - '>='
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 3.0.0
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: rdoc
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- -
|
227
|
+
- - '>'
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: 3.5.0
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - '>'
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 3.5.0
|
237
237
|
description: WebMock allows stubbing HTTP requests and setting expectations on HTTP
|
@@ -242,10 +242,10 @@ executables: []
|
|
242
242
|
extensions: []
|
243
243
|
extra_rdoc_files: []
|
244
244
|
files:
|
245
|
-
-
|
246
|
-
-
|
247
|
-
-
|
248
|
-
-
|
245
|
+
- .gemtest
|
246
|
+
- .gitignore
|
247
|
+
- .rspec-tm
|
248
|
+
- .travis.yml
|
249
249
|
- CHANGELOG.md
|
250
250
|
- Gemfile
|
251
251
|
- LICENSE
|
@@ -276,6 +276,9 @@ files:
|
|
276
276
|
- lib/webmock/http_lib_adapters/net_http_response.rb
|
277
277
|
- lib/webmock/http_lib_adapters/patron_adapter.rb
|
278
278
|
- lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb
|
279
|
+
- lib/webmock/matchers/any_arg_matcher.rb
|
280
|
+
- lib/webmock/matchers/hash_argument_matcher.rb
|
281
|
+
- lib/webmock/matchers/hash_excluding_matcher.rb
|
279
282
|
- lib/webmock/matchers/hash_including_matcher.rb
|
280
283
|
- lib/webmock/minitest.rb
|
281
284
|
- lib/webmock/rack_response.rb
|
@@ -349,6 +352,7 @@ files:
|
|
349
352
|
- spec/unit/errors_spec.rb
|
350
353
|
- spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb
|
351
354
|
- spec/unit/http_lib_adapters/http_lib_adapter_spec.rb
|
355
|
+
- spec/unit/matchers/hash_excluding_matcher_spec.rb
|
352
356
|
- spec/unit/matchers/hash_including_matcher_spec.rb
|
353
357
|
- spec/unit/rack_response_spec.rb
|
354
358
|
- spec/unit/request_body_diff_spec.rb
|
@@ -384,17 +388,17 @@ require_paths:
|
|
384
388
|
- lib
|
385
389
|
required_ruby_version: !ruby/object:Gem::Requirement
|
386
390
|
requirements:
|
387
|
-
- -
|
391
|
+
- - '>='
|
388
392
|
- !ruby/object:Gem::Version
|
389
393
|
version: '2.0'
|
390
394
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
391
395
|
requirements:
|
392
|
-
- -
|
396
|
+
- - '>='
|
393
397
|
- !ruby/object:Gem::Version
|
394
398
|
version: '0'
|
395
399
|
requirements: []
|
396
400
|
rubyforge_project: webmock
|
397
|
-
rubygems_version: 2.
|
401
|
+
rubygems_version: 2.0.14
|
398
402
|
signing_key:
|
399
403
|
specification_version: 4
|
400
404
|
summary: Library for stubbing HTTP requests in Ruby.
|
@@ -440,6 +444,7 @@ test_files:
|
|
440
444
|
- spec/unit/errors_spec.rb
|
441
445
|
- spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb
|
442
446
|
- spec/unit/http_lib_adapters/http_lib_adapter_spec.rb
|
447
|
+
- spec/unit/matchers/hash_excluding_matcher_spec.rb
|
443
448
|
- spec/unit/matchers/hash_including_matcher_spec.rb
|
444
449
|
- spec/unit/rack_response_spec.rb
|
445
450
|
- spec/unit/request_body_diff_spec.rb
|