webmock 3.8.3 → 3.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/CI.yml +37 -0
- data/CHANGELOG.md +132 -0
- data/Gemfile +1 -1
- data/README.md +70 -30
- data/Rakefile +12 -2
- data/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +7 -5
- data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +6 -3
- data/lib/webmock/http_lib_adapters/http_rb/client.rb +4 -1
- data/lib/webmock/http_lib_adapters/http_rb/response.rb +13 -2
- data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +1 -1
- data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +23 -6
- data/lib/webmock/http_lib_adapters/manticore_adapter.rb +8 -1
- data/lib/webmock/http_lib_adapters/net_http.rb +17 -3
- data/lib/webmock/request_pattern.rb +77 -46
- data/lib/webmock/response.rb +11 -5
- data/lib/webmock/rspec.rb +2 -1
- data/lib/webmock/stub_registry.rb +26 -11
- data/lib/webmock/test_unit.rb +1 -3
- data/lib/webmock/version.rb +1 -1
- data/lib/webmock/webmock.rb +5 -3
- data/spec/acceptance/async_http_client/async_http_client_spec.rb +27 -1
- data/spec/acceptance/em_http_request/em_http_request_spec.rb +56 -0
- data/spec/acceptance/manticore/manticore_spec.rb +32 -0
- data/spec/acceptance/net_http/net_http_spec.rb +38 -0
- data/spec/acceptance/patron/patron_spec_helper.rb +2 -2
- data/spec/acceptance/shared/stubbing_requests.rb +35 -0
- data/spec/unit/request_pattern_spec.rb +171 -48
- data/spec/unit/response_spec.rb +22 -18
- data/spec/unit/webmock_spec.rb +52 -11
- data/test/test_webmock.rb +6 -0
- data/webmock.gemspec +2 -1
- metadata +25 -11
- data/.travis.yml +0 -19
@@ -111,6 +111,21 @@ describe WebMock::RequestPattern do
|
|
111
111
|
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
112
112
|
end
|
113
113
|
|
114
|
+
it "should match if uri matches requesst uri as URI object" do
|
115
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"))).
|
116
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should match if uri proc pattern returning true" do
|
120
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true })).
|
121
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should not match if uri proc pattern returns false" do
|
125
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { false })).
|
126
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
127
|
+
end
|
128
|
+
|
114
129
|
it "should match if uri Addressable::Template pattern matches unescaped form of request uri" do
|
115
130
|
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com/{any_path}"))).
|
116
131
|
to match(WebMock::RequestSignature.new(:get, "www.example.com/my%20path"))
|
@@ -132,6 +147,12 @@ describe WebMock::RequestPattern do
|
|
132
147
|
expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
|
133
148
|
end
|
134
149
|
|
150
|
+
it "should match if Addressable::Template pattern that has ip address host without port matches request uri" do
|
151
|
+
signature = WebMock::RequestSignature.new(:get, "127.0.0.1/1234")
|
152
|
+
uri = Addressable::Template.new("127.0.0.1/{id}")
|
153
|
+
expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
|
154
|
+
end
|
155
|
+
|
135
156
|
it "should match if Addressable::Template pattern host matches request uri" do
|
136
157
|
signature = WebMock::RequestSignature.new(:get, "www.example.com")
|
137
158
|
uri = Addressable::Template.new("{subdomain}.example.com")
|
@@ -144,6 +165,12 @@ describe WebMock::RequestPattern do
|
|
144
165
|
expect(WebMock::RequestPattern.new(:get, uri)).not_to match(signature)
|
145
166
|
end
|
146
167
|
|
168
|
+
it "should match if uri Addressable::Template pattern matches request uri without a schema and a path " do
|
169
|
+
signature = WebMock::RequestSignature.new(:get, "127.0.0.1:3000")
|
170
|
+
uri = Addressable::Template.new("127.0.0.1:3000")
|
171
|
+
expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
|
172
|
+
end
|
173
|
+
|
147
174
|
it "should match for uris with same parameters as pattern" do
|
148
175
|
expect(WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2")).
|
149
176
|
to match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
|
@@ -211,7 +238,7 @@ describe WebMock::RequestPattern do
|
|
211
238
|
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
212
239
|
end
|
213
240
|
|
214
|
-
it "should match request query params if params don't match" do
|
241
|
+
it "should not match request query params if params don't match" do
|
215
242
|
expect(WebMock::RequestPattern.new(:get, /.*example.*/, query: {"x" => ["b", "c"]})).
|
216
243
|
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
217
244
|
end
|
@@ -241,13 +268,85 @@ describe WebMock::RequestPattern do
|
|
241
268
|
end
|
242
269
|
end
|
243
270
|
|
271
|
+
describe "when uri is described as URI" do
|
272
|
+
it "should match request query params" do
|
273
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"), query: {"a" => ["b", "c"]})).
|
274
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
275
|
+
end
|
276
|
+
|
277
|
+
it "should not match request query params if params don't match" do
|
278
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"), query: {"x" => ["b", "c"]})).
|
279
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
280
|
+
end
|
281
|
+
|
282
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
283
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
284
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
285
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
289
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
290
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]}))).
|
291
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
295
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
296
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
297
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
301
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
302
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]}))).
|
303
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
describe "when uri is described as a proc" do
|
308
|
+
it "should match request query params" do
|
309
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true }, query: {"a" => ["b", "c"]})).
|
310
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should not match request query params if params don't match" do
|
314
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true }, query: {"x" => ["b", "c"]})).
|
315
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
316
|
+
end
|
317
|
+
|
318
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
319
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true },
|
320
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
321
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
322
|
+
end
|
323
|
+
|
324
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
325
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true },
|
326
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]}))).
|
327
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
328
|
+
end
|
329
|
+
|
330
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
331
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true },
|
332
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
333
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
334
|
+
end
|
335
|
+
|
336
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
337
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true },
|
338
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]}))).
|
339
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
244
343
|
describe "when uri is described as Addressable::Template" do
|
245
344
|
it "should raise error if query params are specified" do
|
246
345
|
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"), query: {"a" => ["b", "c"]})).
|
247
346
|
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
248
347
|
end
|
249
348
|
|
250
|
-
it "should match request query params if params don't match" do
|
349
|
+
it "should not match request query params if params don't match" do
|
251
350
|
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"), query: {"x" => ["b", "c"]})).
|
252
351
|
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
253
352
|
end
|
@@ -435,69 +534,93 @@ describe WebMock::RequestPattern do
|
|
435
534
|
end
|
436
535
|
|
437
536
|
describe "for request with json body and content type is set to json" do
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
537
|
+
shared_examples "a json body" do
|
538
|
+
it "should match when hash matches body" do
|
539
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
540
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: content_type},
|
541
|
+
body: "{\"a\":\"1\",\"c\":{\"d\":[\"e\",\"f\"]},\"b\":\"five\"}"))
|
542
|
+
end
|
443
543
|
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
544
|
+
it "should match if hash matches body in different form" do
|
545
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
546
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: content_type},
|
547
|
+
body: "{\"a\":\"1\",\"b\":\"five\",\"c\":{\"d\":[\"e\",\"f\"]}}"))
|
548
|
+
end
|
449
549
|
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
550
|
+
it "should not match when body is not json" do
|
551
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
552
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
553
|
+
headers: {content_type: content_type}, body: "foo bar"))
|
554
|
+
end
|
555
|
+
|
556
|
+
it "should not match if request body is different" do
|
557
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1, b: 2})).
|
558
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
559
|
+
headers: {content_type: content_type}, body: "{\"a\":1,\"c\":null}"))
|
560
|
+
end
|
455
561
|
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
562
|
+
it "should not match if request body is has less params than pattern" do
|
563
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1, b: 2})).
|
564
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
565
|
+
headers: {content_type: content_type}, body: "{\"a\":1}"))
|
566
|
+
end
|
567
|
+
|
568
|
+
it "should not match if request body is has more params than pattern" do
|
569
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1})).
|
570
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
571
|
+
headers: {content_type: content_type}, body: "{\"a\":1,\"c\":1}"))
|
572
|
+
end
|
460
573
|
end
|
461
574
|
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
headers: {content_type: 'application/json'}, body: "{\"a\":1}"))
|
575
|
+
context "standard application/json" do
|
576
|
+
let(:content_type) { 'application/json' }
|
577
|
+
it_behaves_like "a json body"
|
466
578
|
end
|
467
579
|
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
headers: {content_type: 'application/json'}, body: "{\"a\":1,\"c\":1}"))
|
580
|
+
context "custom json content type" do
|
581
|
+
let(:content_type) { 'application/vnd.api+json' }
|
582
|
+
it_behaves_like "a json body"
|
472
583
|
end
|
473
584
|
end
|
474
585
|
|
475
586
|
describe "for request with xml body and content type is set to xml" do
|
476
587
|
let(:body_hash) { {"opt" => {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']}}} }
|
477
588
|
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
589
|
+
shared_examples "a xml body" do
|
590
|
+
it "should match when hash matches body" do
|
591
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
592
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: content_type},
|
593
|
+
body: "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
|
594
|
+
end
|
483
595
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
596
|
+
it "should match if hash matches body in different form" do
|
597
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
598
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: content_type},
|
599
|
+
body: "<opt b=\"five\" a=\"1\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
|
600
|
+
end
|
489
601
|
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
602
|
+
it "should not match when body is not xml" do
|
603
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
604
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
605
|
+
headers: {content_type: content_type}, body: "foo bar"))
|
606
|
+
end
|
495
607
|
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
608
|
+
it "matches when the content type include a charset" do
|
609
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
610
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: "#{content_type};charset=UTF-8"},
|
611
|
+
body: "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
|
612
|
+
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
context "standard application/xml" do
|
617
|
+
let(:content_type) { 'application/xml' }
|
618
|
+
it_behaves_like "a xml body"
|
619
|
+
end
|
500
620
|
|
621
|
+
context "custom xml content type" do
|
622
|
+
let(:content_type) { 'application/atom+xml' }
|
623
|
+
it_behaves_like "a xml body"
|
501
624
|
end
|
502
625
|
end
|
503
626
|
end
|
data/spec/unit/response_spec.rb
CHANGED
@@ -130,11 +130,15 @@ describe WebMock::Response do
|
|
130
130
|
# Users of webmock commonly make the mistake of stubbing the response
|
131
131
|
# body to return a hash, to prevent this:
|
132
132
|
#
|
133
|
-
it "should error if
|
133
|
+
it "should error if given a non-allowed type: a hash" do
|
134
134
|
expect { WebMock::Response.new(body: Hash.new) }.to \
|
135
135
|
raise_error(WebMock::Response::InvalidBody)
|
136
136
|
end
|
137
137
|
|
138
|
+
it "should error if given a non-allowed type: something that is not a hash" do
|
139
|
+
expect { WebMock::Response.new(body: 123) }.to \
|
140
|
+
raise_error(WebMock::Response::InvalidBody)
|
141
|
+
end
|
138
142
|
end
|
139
143
|
|
140
144
|
describe "from raw response" do
|
@@ -152,12 +156,12 @@ describe WebMock::Response do
|
|
152
156
|
|
153
157
|
it "should read headers" do
|
154
158
|
expect(@response.headers).to eq({
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
159
|
+
"Date"=>"Sat, 23 Jan 2010 01:01:05 GMT",
|
160
|
+
"Content-Type"=>"text/html; charset=UTF-8",
|
161
|
+
"Content-Length"=>"419",
|
162
|
+
"Connection"=>"Keep-Alive",
|
163
|
+
"Accept"=>"image/jpeg, image/png"
|
164
|
+
})
|
161
165
|
end
|
162
166
|
|
163
167
|
it "should read body" do
|
@@ -182,12 +186,12 @@ describe WebMock::Response do
|
|
182
186
|
|
183
187
|
it "should read headers" do
|
184
188
|
expect(@response.headers).to eq({
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
189
|
+
"Date"=>"Sat, 23 Jan 2010 01:01:05 GMT",
|
190
|
+
"Content-Type"=>"text/html; charset=UTF-8",
|
191
|
+
"Content-Length"=>"419",
|
192
|
+
"Connection"=>"Keep-Alive",
|
193
|
+
"Accept"=>"image/jpeg, image/png"
|
194
|
+
})
|
191
195
|
end
|
192
196
|
|
193
197
|
it "should read body" do
|
@@ -234,11 +238,11 @@ describe WebMock::Response do
|
|
234
238
|
it "should evaluate new response with evaluated options" do
|
235
239
|
request_signature = WebMock::RequestSignature.new(:post, "www.example.com", body: "abc", headers: {'A' => 'a'})
|
236
240
|
response = WebMock::DynamicResponse.new(lambda {|request|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
241
|
+
{
|
242
|
+
body: request.body,
|
243
|
+
headers: request.headers,
|
244
|
+
status: 302
|
245
|
+
}
|
242
246
|
})
|
243
247
|
evaluated_response = response.evaluate(request_signature)
|
244
248
|
expect(evaluated_response.body).to eq("abc")
|
data/spec/unit/webmock_spec.rb
CHANGED
@@ -1,19 +1,60 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "WebMock
|
4
|
-
it "should report version" do
|
5
|
-
expect(WebMock.version).to eq(WebMock::VERSION)
|
6
|
-
end
|
3
|
+
describe "WebMock" do
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
describe ".version" do
|
6
|
+
it "should report version" do
|
7
|
+
expect(WebMock.version).to eq(WebMock::VERSION)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should not require safe_yaml" do
|
11
|
+
expect(defined?SafeYAML).to eq(nil)
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
it "should alias enable_net_connect! to allow_net_connect!" do
|
15
|
+
expect(WebMock.method(:enable_net_connect!)).to eq(WebMock.method(:allow_net_connect!))
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should alias disallow_net_connect! to disable_net_connect!" do
|
19
|
+
expect(WebMock.method(:disallow_net_connect!)).to eq(WebMock.method(:disable_net_connect!))
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
|
-
|
17
|
-
|
23
|
+
describe ".net_connect_allowed?" do
|
24
|
+
context 'enabled globally' do
|
25
|
+
before do
|
26
|
+
WebMock.enable_net_connect!
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'without arguments' do
|
30
|
+
it 'returns WebMock::Config.instance.allow_net_connect' do
|
31
|
+
expect(WebMock.net_connect_allowed?).to eql(true)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'disabled with allowed remote string' do
|
37
|
+
before do
|
38
|
+
WebMock.disable_net_connect!(allow: "http://192.168.64.2:20031")
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'without arguments' do
|
42
|
+
it 'returns WebMock::Config.instance.allow_net_connect' do
|
43
|
+
expect(WebMock.net_connect_allowed?).to eql(false)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'disabled globally' do
|
49
|
+
before do
|
50
|
+
WebMock.disable_net_connect!
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'without arguments' do
|
54
|
+
it 'returns WebMock::Config.instance.allow_net_connect' do
|
55
|
+
expect(WebMock.net_connect_allowed?).to eql(false)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
18
59
|
end
|
19
60
|
end
|
data/test/test_webmock.rb
CHANGED
@@ -3,4 +3,10 @@ require File.expand_path(File.dirname(__FILE__) + '/shared_test')
|
|
3
3
|
|
4
4
|
class TestWebMock < Test::Unit::TestCase
|
5
5
|
include SharedTest
|
6
|
+
|
7
|
+
def teardown
|
8
|
+
# Ensure global Test::Unit teardown was called
|
9
|
+
assert_empty WebMock::RequestRegistry.instance.requested_signatures.hash
|
10
|
+
assert_empty WebMock::StubRegistry.instance.request_stubs
|
11
|
+
end
|
6
12
|
end
|
data/webmock.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
|
24
24
|
s.required_ruby_version = '>= 2.0'
|
25
25
|
|
26
|
-
s.add_dependency 'addressable', '>= 2.
|
26
|
+
s.add_dependency 'addressable', '>= 2.8.0'
|
27
27
|
s.add_dependency 'crack', '>= 0.3.2'
|
28
28
|
s.add_dependency 'hashdiff', ['>= 0.4.0', '< 2.0.0']
|
29
29
|
|
@@ -45,6 +45,7 @@ Gem::Specification.new do |s|
|
|
45
45
|
s.add_development_dependency 'minitest', '>= 5.0.0'
|
46
46
|
s.add_development_dependency 'test-unit', '>= 3.0.0'
|
47
47
|
s.add_development_dependency 'rdoc', '> 3.5.0'
|
48
|
+
s.add_development_dependency 'webrick'
|
48
49
|
|
49
50
|
s.files = `git ls-files`.split("\n")
|
50
51
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
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: 3.
|
4
|
+
version: 3.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartosz Blimke
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.8.0
|
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
|
-
version: 2.
|
26
|
+
version: 2.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: crack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -254,6 +254,20 @@ dependencies:
|
|
254
254
|
- - ">"
|
255
255
|
- !ruby/object:Gem::Version
|
256
256
|
version: 3.5.0
|
257
|
+
- !ruby/object:Gem::Dependency
|
258
|
+
name: webrick
|
259
|
+
requirement: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - ">="
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: '0'
|
264
|
+
type: :development
|
265
|
+
prerelease: false
|
266
|
+
version_requirements: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - ">="
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '0'
|
257
271
|
description: WebMock allows stubbing HTTP requests and setting expectations on HTTP
|
258
272
|
requests.
|
259
273
|
email:
|
@@ -263,9 +277,9 @@ extensions: []
|
|
263
277
|
extra_rdoc_files: []
|
264
278
|
files:
|
265
279
|
- ".gemtest"
|
280
|
+
- ".github/workflows/CI.yml"
|
266
281
|
- ".gitignore"
|
267
282
|
- ".rspec-tm"
|
268
|
-
- ".travis.yml"
|
269
283
|
- CHANGELOG.md
|
270
284
|
- Gemfile
|
271
285
|
- LICENSE
|
@@ -407,11 +421,11 @@ licenses:
|
|
407
421
|
- MIT
|
408
422
|
metadata:
|
409
423
|
bug_tracker_uri: https://github.com/bblimke/webmock/issues
|
410
|
-
changelog_uri: https://github.com/bblimke/webmock/blob/v3.
|
411
|
-
documentation_uri: https://www.rubydoc.info/gems/webmock/3.
|
412
|
-
source_code_uri: https://github.com/bblimke/webmock/tree/v3.
|
424
|
+
changelog_uri: https://github.com/bblimke/webmock/blob/v3.14.0/CHANGELOG.md
|
425
|
+
documentation_uri: https://www.rubydoc.info/gems/webmock/3.14.0
|
426
|
+
source_code_uri: https://github.com/bblimke/webmock/tree/v3.14.0
|
413
427
|
wiki_uri: https://github.com/bblimke/webmock/wiki
|
414
|
-
post_install_message:
|
428
|
+
post_install_message:
|
415
429
|
rdoc_options: []
|
416
430
|
require_paths:
|
417
431
|
- lib
|
@@ -427,7 +441,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
427
441
|
version: '0'
|
428
442
|
requirements: []
|
429
443
|
rubygems_version: 3.1.2
|
430
|
-
signing_key:
|
444
|
+
signing_key:
|
431
445
|
specification_version: 4
|
432
446
|
summary: Library for stubbing HTTP requests in Ruby.
|
433
447
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
before_install:
|
2
|
-
- gem update --system -N
|
3
|
-
rvm:
|
4
|
-
- 2.3.8
|
5
|
-
- 2.4.6
|
6
|
-
- 2.5.5
|
7
|
-
- 2.6.3
|
8
|
-
- 2.7.0
|
9
|
-
- rbx-2
|
10
|
-
- ruby-head
|
11
|
-
- jruby-9.1.17.0
|
12
|
-
- jruby-9.2.7.0
|
13
|
-
- jruby-head
|
14
|
-
jdk: openjdk8
|
15
|
-
matrix:
|
16
|
-
allow_failures:
|
17
|
-
- rvm: jruby-head
|
18
|
-
- rvm: ruby-head
|
19
|
-
- rvm: rbx-2
|