webmock 3.11.0 → 3.12.1

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
  SHA256:
3
- metadata.gz: ee9c189319718f559e90e9e6d031d8dbdac98e9f0ae84c0c7e79d90bfc0dd493
4
- data.tar.gz: cde291017ee8a2587c03e21d20317b96755ac15b94f1e4f287acc035c08ad904
3
+ metadata.gz: 9da0e1f9d2507b4f2e84fc1b4fb4dbe513daba94771af7a255199c1f93ac7cbf
4
+ data.tar.gz: ddc87014539d9e40044c2039cd6a0f82d4da9e44035066481c7876e306322922
5
5
  SHA512:
6
- metadata.gz: 54838a253c586b32dfaf604b8f4c8efff34bb81a888bda860ca6e9b58ff0a5430376852e0d17a84d8ee4e56a088031d75d3ddb3d00d803789e6eb013e5493d9a
7
- data.tar.gz: 9ddee20d1741ad835224254caaa8bbeda8807dc71c246c4ea8c3be18f31c089658f8c7a3b2fdf14da1f9cda32fe7c7cbf9cb594445ba92d47fa549754dd9b27e
6
+ metadata.gz: feb255076779f8f3311238a2f86d3ac4aeac85d904b9ce7972f80df011cffaac9e63322267c8a71cb5ed692b9cbc40fed75dacc16a1a4a377376d4abb89e89d6
7
+ data.tar.gz: e4e881fa8960506b5acec58312e2cd40d2fbc5f4f54487e8893713bba05459ca16b4ec0951c25aee2a239a885fb0a62637faf371b2eb46aca3e0d9ba0f5c1a94
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby:
16
+ - head
17
+ - '3.0'
18
+ - '2.7'
19
+ - '2.6'
20
+ - '2.5'
21
+ - jruby
22
+ continue-on-error: ${{ matrix.ruby == 'head' }}
23
+ name: Ruby ${{ matrix.ruby }}
24
+ env:
25
+ JRUBY_OPTS: "--debug"
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - name: Install Apt Packages
29
+ run: |
30
+ sudo apt-get install libcurl4-openssl-dev -y
31
+ - uses: ruby/setup-ruby@v1
32
+ continue-on-error: true
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ bundler-cache: true
36
+ - run: |
37
+ bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,10 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ # 3.12.1
4
+
5
+ * Fixed handling of URIs with IPv6 addresses with square brackets when in Net::HTTP adapter.
6
+
7
+ Thanks to [Johanna Hartmann](https://github.com/JohannaHartmann)
8
+
9
+ # 3.12.0
10
+
11
+ * Added support for handling custom JSON and XML content types e.g. 'application/vnd.api+json'
12
+
13
+ # 3.11.3
14
+
15
+ * Fixed async-http adapter to only considered requests as real if they are real.
16
+
17
+ Thanks to Thanks to [Tony Schneider](https://github.com/tonywok) and [Samuel Williams](https://github.com/ioquatix)
18
+
19
+ # 3.11.2
20
+
21
+ * Fix for Manticore streaming mode
22
+
23
+ Thanks to [Oleksiy Kovyrin](https://github.com/kovyrin)
24
+
25
+ # 3.11.1
26
+
27
+ * Compatibility with async-http 0.54+
28
+
29
+ Thanks to [Jun Jiang](https://github.com/jasl)
30
+
3
31
  # 3.11.0
4
32
 
5
33
  * Added support for `features` in http.rb adapter.
6
34
 
7
- Thanks to [Carl (ce07c3)](https://github.com/ce07c3)
35
+ Thanks to [Carl (ce07c3)](https://github.com/ce07c3)
8
36
 
9
37
  # 3.10.0
10
38
 
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'http://rubygems.org/'
1
+ source 'https://rubygems.org/'
2
2
 
3
3
  gemspec
4
4
 
data/README.md CHANGED
@@ -1152,6 +1152,12 @@ People who submitted patches and new features or suggested improvements. Many th
1152
1152
  * Jesse Bowes
1153
1153
  * Marek Kasztelnik
1154
1154
  * ce07c3
1155
+ * Jun Jiang
1156
+ * Oleksiy Kovyrin
1157
+ * Matt Larraz
1158
+ * Tony Schneider
1159
+ * Niklas Hösl
1160
+ * Johanna Hartmann
1155
1161
 
1156
1162
  For a full list of contributors you can visit the
1157
1163
  [contributors](https://github.com/bblimke/webmock/contributors) page.
data/Rakefile CHANGED
@@ -3,24 +3,34 @@ Bundler::GemHelper.install_tasks
3
3
 
4
4
  require "rspec/core/rake_task"
5
5
  RSpec::Core::RakeTask.new(:spec) do |t|
6
- t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
6
+ t.rspec_opts = %w[
7
+ --force-color
8
+ --format progress
9
+ --require ./spec/spec_helper.rb
10
+ ]
7
11
  t.pattern = 'spec/**/*_spec.rb'
8
12
  end
9
13
 
10
14
  RSpec::Core::RakeTask.new(:spec_http_without_webmock) do |t|
11
- t.rspec_opts = ["-c", "-f progress", "-r ./spec/acceptance/net_http/real_net_http_spec.rb"]
15
+ t.rspec_opts = %w[
16
+ --force-color
17
+ --format progress
18
+ --require ./spec/acceptance/net_http/real_net_http_spec.rb
19
+ ]
12
20
  t.pattern = 'spec/acceptance/net_http/real_net_http_spec.rb'
13
21
  end
14
22
 
15
23
  require 'rake/testtask'
16
24
  Rake::TestTask.new(:test) do |test|
17
25
  test.test_files = FileList["test/**/*.rb"].exclude("test/test_helper.rb")
26
+ test.options = "--use-color"
18
27
  test.verbose = false
19
28
  test.warning = false
20
29
  end
21
30
 
22
31
  Rake::TestTask.new(:minitest) do |test|
23
32
  test.test_files = FileList["minitest/**/*.rb"].exclude("test/test_helper.rb")
33
+ test.options = "--pride"
24
34
  test.verbose = false
25
35
  test.warning = false
26
36
  end
@@ -40,8 +40,8 @@ if defined?(Async::HTTP)
40
40
  )
41
41
  webmock_endpoint = WebMockEndpoint.new(scheme, authority, protocol)
42
42
 
43
- @network_client = WebMockClient.new(endpoint, protocol, scheme, authority, **options)
44
- @webmock_client = WebMockClient.new(webmock_endpoint, protocol, scheme, authority, **options)
43
+ @network_client = WebMockClient.new(endpoint, **options)
44
+ @webmock_client = WebMockClient.new(webmock_endpoint, **options)
45
45
 
46
46
  @scheme = scheme
47
47
  @authority = authority
@@ -55,6 +55,7 @@ if defined?(Async::HTTP)
55
55
  WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)
56
56
  webmock_response = WebMock::StubRegistry.instance.response_for_request(request_signature)
57
57
  net_connect_allowed = WebMock.net_connect_allowed?(request_signature.uri)
58
+ real_request = false
58
59
 
59
60
  if webmock_response
60
61
  webmock_response.raise_error_if_any
@@ -63,6 +64,7 @@ if defined?(Async::HTTP)
63
64
  response = @webmock_client.call(request)
64
65
  elsif net_connect_allowed
65
66
  response = @network_client.call(request)
67
+ real_request = true
66
68
  else
67
69
  raise WebMock::NetConnectNotAllowedError.new(request_signature) unless webmock_response
68
70
  end
@@ -72,7 +74,7 @@ if defined?(Async::HTTP)
72
74
  WebMock::CallbackRegistry.invoke_callbacks(
73
75
  {
74
76
  lib: :async_http_client,
75
- real_request: net_connect_allowed
77
+ real_request: real_request
76
78
  },
77
79
  request_signature,
78
80
  webmock_response
@@ -127,8 +127,15 @@ if defined?(Manticore)
127
127
  def generate_webmock_response(manticore_response)
128
128
  webmock_response = WebMock::Response.new
129
129
  webmock_response.status = [manticore_response.code, manticore_response.message]
130
- webmock_response.body = manticore_response.body
131
130
  webmock_response.headers = manticore_response.headers
131
+
132
+ # The attempt to read the body could fail if manticore is used in a streaming mode
133
+ webmock_response.body = begin
134
+ manticore_response.body
135
+ rescue ::Manticore::StreamClosedException
136
+ nil
137
+ end
138
+
132
139
  webmock_response
133
140
  end
134
141
  end
@@ -313,8 +313,6 @@ module WebMock
313
313
  module NetHTTPUtility
314
314
 
315
315
  def self.request_signature_from_request(net_http, request, body = nil)
316
- protocol = net_http.use_ssl? ? "https" : "http"
317
-
318
316
  path = request.path
319
317
 
320
318
  if path.respond_to?(:request_uri) #https://github.com/bblimke/webmock/issues/288
@@ -323,7 +321,7 @@ module WebMock
323
321
 
324
322
  path = WebMock::Util::URI.heuristic_parse(path).request_uri if path =~ /^http/
325
323
 
326
- uri = "#{protocol}://#{net_http.address}:#{net_http.port}#{path}"
324
+ uri = get_uri(net_http, path)
327
325
  method = request.method.downcase.to_sym
328
326
 
329
327
  headers = Hash[*request.to_hash.map {|k,v| [k, v]}.inject([]) {|r,x| r + x}]
@@ -343,6 +341,15 @@ module WebMock
343
341
  WebMock::RequestSignature.new(method, uri, body: request.body, headers: headers)
344
342
  end
345
343
 
344
+ def self.get_uri(net_http, path)
345
+ protocol = net_http.use_ssl? ? "https" : "http"
346
+
347
+ hostname = net_http.address
348
+ hostname = "[#{hostname}]" if /\A\[.*\]\z/ !~ hostname && /:/ =~ hostname
349
+
350
+ "#{protocol}://#{hostname}:#{net_http.port}#{path}"
351
+ end
352
+
346
353
  def self.validate_headers(headers)
347
354
  # For Ruby versions < 2.3.0, if you make a request with headers that are symbols
348
355
  # Net::HTTP raises a NoMethodError
@@ -295,8 +295,9 @@ module WebMock
295
295
  end
296
296
 
297
297
  private
298
+
298
299
  def body_as_hash(body, content_type)
299
- case BODY_FORMATS[content_type]
300
+ case body_format(content_type)
300
301
  when :json then
301
302
  WebMock::Util::JSON.parse(body)
302
303
  when :xml then
@@ -306,6 +307,11 @@ module WebMock
306
307
  end
307
308
  end
308
309
 
310
+ def body_format(content_type)
311
+ normalized_content_type = content_type.sub(/\A(application\/)[a-zA-Z0-9.-]+\+(json|xml)\Z/,'\1\2')
312
+ BODY_FORMATS[normalized_content_type]
313
+ end
314
+
309
315
  def assert_non_multipart_body(content_type)
310
316
  if content_type =~ %r{^multipart/form-data}
311
317
  raise ArgumentError.new("WebMock does not support matching body for multipart/form-data requests yet :(")
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '3.11.0' unless defined?(::WebMock::VERSION)
2
+ VERSION = '3.12.1' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -135,6 +135,28 @@ unless RUBY_PLATFORM =~ /java/
135
135
  expect { make_request(:get, 'http://www.example.com') }.to raise_error Async::TimeoutError
136
136
  end
137
137
 
138
+ it 'does not invoke "after real request" callbacks for stubbed requests' do
139
+ WebMock.allow_net_connect!
140
+ stub_request(:get, 'http://www.example.com').to_return(body: 'abc')
141
+
142
+ callback_invoked = false
143
+ WebMock.after_request(real_requests_only: true) { |_| callback_invoked = true }
144
+
145
+ make_request(:get, 'http://www.example.com')
146
+ expect(callback_invoked).to eq(false)
147
+ end
148
+
149
+ it 'does invoke "after request" callbacks for stubbed requests' do
150
+ WebMock.allow_net_connect!
151
+ stub_request(:get, 'http://www.example.com').to_return(body: 'abc')
152
+
153
+ callback_invoked = false
154
+ WebMock.after_request(real_requests_only: false) { |_| callback_invoked = true }
155
+
156
+ make_request(:get, 'http://www.example.com')
157
+ expect(callback_invoked).to eq(true)
158
+ end
159
+
138
160
  context 'scheme and protocol' do
139
161
  let(:default_response_headers) { {} }
140
162
 
@@ -70,6 +70,38 @@ if RUBY_PLATFORM =~ /java/
70
70
  expect(failure_handler).to have_received(:call)
71
71
  end
72
72
  end
73
+
74
+ context 'when used in a streaming mode' do
75
+ let(:webmock_server_url) {"http://#{WebMockServer.instance.host_with_port}/"}
76
+ let(:result_chunks) { [] }
77
+
78
+ def manticore_streaming_get
79
+ Manticore.get(webmock_server_url).tap do |req|
80
+ req.on_success do |response|
81
+ response.body do |chunk|
82
+ result_chunks << chunk
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ context 'when connections are allowed' do
89
+ it 'works' do
90
+ WebMock.allow_net_connect!
91
+ expect { manticore_streaming_get.call }.to_not raise_error
92
+ expect(result_chunks).to_not be_empty
93
+ end
94
+ end
95
+
96
+ context 'when stubbed' do
97
+ it 'works' do
98
+ stub_body = 'hello!'
99
+ stub_request(:get, webmock_server_url).to_return(body: stub_body)
100
+ expect { manticore_streaming_get.call }.to_not raise_error
101
+ expect(result_chunks).to eq [stub_body]
102
+ end
103
+ end
104
+ end
73
105
  end
74
106
  end
75
107
  end
@@ -340,4 +340,30 @@ describe "Net:HTTP" do
340
340
  http.request(req, '')
341
341
  end
342
342
  end
343
+
344
+ describe "hostname handling" do
345
+ it "should set brackets around the hostname if it is an IPv6 address" do
346
+ net_http = Net::HTTP.new('b2dc:5bdf:4f0d::3014:e0ca', 80)
347
+ path = '/example.jpg'
348
+ expect(WebMock::NetHTTPUtility.get_uri(net_http, path)).to eq('http://[b2dc:5bdf:4f0d::3014:e0ca]:80/example.jpg')
349
+ end
350
+
351
+ it "should not set brackets around the hostname if it is already wrapped by brackets" do
352
+ net_http = Net::HTTP.new('[b2dc:5bdf:4f0d::3014:e0ca]', 80)
353
+ path = '/example.jpg'
354
+ expect(WebMock::NetHTTPUtility.get_uri(net_http, path)).to eq('http://[b2dc:5bdf:4f0d::3014:e0ca]:80/example.jpg')
355
+ end
356
+
357
+ it "should not set brackets around the hostname if it is an IPv4 address" do
358
+ net_http = Net::HTTP.new('181.152.137.168', 80)
359
+ path = '/example.jpg'
360
+ expect(WebMock::NetHTTPUtility.get_uri(net_http, path)).to eq('http://181.152.137.168:80/example.jpg')
361
+ end
362
+
363
+ it "should not set brackets around the hostname if it is a domain" do
364
+ net_http = Net::HTTP.new('www.example.com', 80)
365
+ path = '/example.jpg'
366
+ expect(WebMock::NetHTTPUtility.get_uri(net_http, path)).to eq('http://www.example.com:80/example.jpg')
367
+ end
368
+ end
343
369
  end
@@ -534,69 +534,93 @@ describe WebMock::RequestPattern do
534
534
  end
535
535
 
536
536
  describe "for request with json body and content type is set to json" do
537
- it "should match when hash matches body" do
538
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
539
- to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: 'application/json'},
540
- body: "{\"a\":\"1\",\"c\":{\"d\":[\"e\",\"f\"]},\"b\":\"five\"}"))
541
- end
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
542
543
 
543
- it "should match if hash matches body in different form" do
544
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
545
- to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: 'application/json'},
546
- body: "{\"a\":\"1\",\"b\":\"five\",\"c\":{\"d\":[\"e\",\"f\"]}}"))
547
- end
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
548
549
 
549
- it "should not match when body is not json" do
550
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
551
- not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
552
- headers: {content_type: 'application/json'}, body: "foo bar"))
553
- end
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
554
561
 
555
- it "should not match if request body is different" do
556
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1, b: 2})).
557
- not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
558
- headers: {content_type: 'application/json'}, body: "{\"a\":1,\"c\":null}"))
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
559
573
  end
560
574
 
561
- it "should not match if request body is has less params than pattern" do
562
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1, b: 2})).
563
- not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
564
- 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"
565
578
  end
566
579
 
567
- it "should not match if request body is has more params than pattern" do
568
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1})).
569
- not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
570
- 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"
571
583
  end
572
584
  end
573
585
 
574
586
  describe "for request with xml body and content type is set to xml" do
575
587
  let(:body_hash) { {"opt" => {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']}}} }
576
588
 
577
- it "should match when hash matches body" do
578
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
579
- to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: 'application/xml'},
580
- body: "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
581
- end
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
582
595
 
583
- it "should match if hash matches body in different form" do
584
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
585
- to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: 'application/xml'},
586
- body: "<opt b=\"five\" a=\"1\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
587
- end
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
588
601
 
589
- it "should not match when body is not xml" do
590
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
591
- not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
592
- headers: {content_type: 'application/xml'}, body: "foo bar"))
593
- end
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
594
607
 
595
- it "matches when the content type include a charset" do
596
- expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
597
- to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: 'application/xml;charset=UTF-8'},
598
- body: "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
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
599
620
 
621
+ context "custom xml content type" do
622
+ let(:content_type) { 'application/atom+xml' }
623
+ it_behaves_like "a xml body"
600
624
  end
601
625
  end
602
626
  end
data/webmock.gemspec CHANGED
@@ -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.11.0
4
+ version: 3.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Blimke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-17 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -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,6 +277,7 @@ 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
283
  - ".travis.yml"
@@ -407,9 +422,9 @@ licenses:
407
422
  - MIT
408
423
  metadata:
409
424
  bug_tracker_uri: https://github.com/bblimke/webmock/issues
410
- changelog_uri: https://github.com/bblimke/webmock/blob/v3.11.0/CHANGELOG.md
411
- documentation_uri: https://www.rubydoc.info/gems/webmock/3.11.0
412
- source_code_uri: https://github.com/bblimke/webmock/tree/v3.11.0
425
+ changelog_uri: https://github.com/bblimke/webmock/blob/v3.12.1/CHANGELOG.md
426
+ documentation_uri: https://www.rubydoc.info/gems/webmock/3.12.1
427
+ source_code_uri: https://github.com/bblimke/webmock/tree/v3.12.1
413
428
  wiki_uri: https://github.com/bblimke/webmock/wiki
414
429
  post_install_message:
415
430
  rdoc_options: []