webmock 1.22.3 → 1.22.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +25 -0
- data/README.md +4 -1
- data/lib/webmock/http_lib_adapters/curb_adapter.rb +6 -6
- data/lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb +1 -2
- data/lib/webmock/http_lib_adapters/http_rb/response.rb +27 -6
- data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +7 -1
- data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +34 -6
- data/lib/webmock/http_lib_adapters/net_http.rb +16 -2
- data/lib/webmock/request_execution_verifier.rb +5 -5
- data/lib/webmock/response.rb +4 -2
- data/lib/webmock/version.rb +1 -1
- data/spec/acceptance/curb/curb_spec.rb +0 -2
- data/spec/acceptance/em_http_request/em_http_request_spec.rb +1 -1
- data/spec/acceptance/http_rb/http_rb_spec.rb +19 -5
- data/spec/acceptance/http_rb/http_rb_spec_helper.rb +4 -2
- data/spec/acceptance/httpclient/httpclient_spec.rb +10 -0
- data/spec/acceptance/net_http/net_http_spec.rb +2 -2
- data/spec/acceptance/patron/patron_spec.rb +1 -3
- data/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +11 -2
- data/spec/acceptance/shared/callbacks.rb +1 -0
- data/spec/support/webmock_server.rb +1 -1
- data/spec/unit/rack_response_spec.rb +2 -2
- data/webmock.gemspec +6 -4
- metadata +43 -142
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA512:
|
3
|
+
metadata.gz: f264f2ee632cba4f292af8842162b194ca3d2869455452e0b4f3a37c090991ee32a4fb8045cd341f023ed54c1aba167ead51af0cfb08e9f94dd9031feaf716d9
|
4
|
+
data.tar.gz: 7b2896f0007c759df21777fb3a6497efef8293d230e3356124ab786e12d768ee251163d1bfaa0bf5f653db3b845c3134b542772ba40c69f4c69cd357528b5252
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: b14156b6d829103daa974ba8bf5b5c3479077cb7
|
7
|
+
data.tar.gz: 205f1ed9b69fd533481ebe3161bf82e33f2a134a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.22.5
|
4
|
+
|
5
|
+
* Fixes [bug](https://github.com/bblimke/webmock/issues/565) where WebMock tries
|
6
|
+
to alias a method that is deprecated in Ruby Versions > 1.9.2 ('sysread' for class 'StringIO')
|
7
|
+
|
8
|
+
Thanks to [Marcos Acosta](https://github.com/mmaa) for discovering this bug.
|
9
|
+
|
10
|
+
## 1.22.4
|
11
|
+
|
12
|
+
* Adds support for JSONClient (a subclass of HTTPClient)
|
13
|
+
|
14
|
+
Thanks to [Andrew Kozin](https://github.com/nepalez)
|
15
|
+
|
16
|
+
* Adds support for Ruby 2.3.0
|
17
|
+
|
18
|
+
Thanks to [Charles Pence](https://github.com/cpence)
|
19
|
+
|
20
|
+
* Adds support for [http](https://github.com/httprb/http) versions >= 1.0.0
|
21
|
+
|
22
|
+
Thanks to [Alexey Zapparov](https://github.com/ixti)
|
23
|
+
|
24
|
+
* Fixes support for Ruby 1.8.7 by restrciting Addressable version < 2.4.0
|
25
|
+
|
26
|
+
Thanks to [Matthew Rudy Jacobs](https://github.com/matthewrudy)
|
27
|
+
|
3
28
|
## 1.22.3
|
4
29
|
|
5
30
|
* Return "effective_url" attribute in Typhoeus::Response
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Features
|
|
13
13
|
* Smart matching of the same URIs in different representations (also encoded and non encoded forms)
|
14
14
|
* Smart matching of the same headers in different representations.
|
15
15
|
* Support for Test::Unit
|
16
|
-
* Support for RSpec
|
16
|
+
* Support for RSpec
|
17
17
|
* Support for MiniTest
|
18
18
|
|
19
19
|
Supported HTTP libraries
|
@@ -39,6 +39,7 @@ Supported Ruby Interpreters
|
|
39
39
|
* MRI 2.0.0
|
40
40
|
* MRI 2.1
|
41
41
|
* MRI 2.2
|
42
|
+
* MRI 2.3
|
42
43
|
* REE 1.8.7
|
43
44
|
* JRuby
|
44
45
|
* Rubinius
|
@@ -984,6 +985,8 @@ People who submitted patches and new features or suggested improvements. Many th
|
|
984
985
|
* Magne Land
|
985
986
|
* yurivm
|
986
987
|
* Mike Knepper
|
988
|
+
* Charles Pence
|
989
|
+
* Alexey Zapparov
|
987
990
|
|
988
991
|
For a full list of contributors you can visit the
|
989
992
|
[contributors](https://github.com/bblimke/webmock/contributors) page.
|
@@ -54,8 +54,8 @@ if defined?(Curl)
|
|
54
54
|
|
55
55
|
module Curl
|
56
56
|
class WebMockCurlEasy < Curl::Easy
|
57
|
-
def curb_or_webmock
|
58
57
|
|
58
|
+
def curb_or_webmock
|
59
59
|
request_signature = build_request_signature
|
60
60
|
WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)
|
61
61
|
|
@@ -238,25 +238,25 @@ if defined?(Curl)
|
|
238
238
|
end
|
239
239
|
|
240
240
|
def body_str
|
241
|
-
@body_str
|
241
|
+
@body_str ||= super
|
242
242
|
end
|
243
243
|
alias body body_str
|
244
244
|
|
245
245
|
def response_code
|
246
|
-
@response_code
|
246
|
+
@response_code ||= super
|
247
247
|
end
|
248
248
|
|
249
249
|
def header_str
|
250
|
-
@header_str
|
250
|
+
@header_str ||= super
|
251
251
|
end
|
252
252
|
alias head header_str
|
253
253
|
|
254
254
|
def last_effective_url
|
255
|
-
@last_effective_url
|
255
|
+
@last_effective_url ||= super
|
256
256
|
end
|
257
257
|
|
258
258
|
def content_type
|
259
|
-
@content_type
|
259
|
+
@content_type ||= super
|
260
260
|
end
|
261
261
|
|
262
262
|
%w[ success failure missing header body complete progress ].each do |callback|
|
@@ -7,7 +7,6 @@ if defined?(EventMachine::HttpClient)
|
|
7
7
|
OriginalHttpClient = EventMachine::HttpClient unless const_defined?(:OriginalHttpClient)
|
8
8
|
OriginalHttpConnection = EventMachine::HttpConnection unless const_defined?(:OriginalHttpConnection)
|
9
9
|
|
10
|
-
|
11
10
|
def self.enable!
|
12
11
|
EventMachine.send(:remove_const, :HttpConnection)
|
13
12
|
EventMachine.send(:const_set, :HttpConnection, EventMachine::WebMockHttpConnection)
|
@@ -26,7 +25,6 @@ if defined?(EventMachine::HttpClient)
|
|
26
25
|
end
|
27
26
|
|
28
27
|
module EventMachine
|
29
|
-
|
30
28
|
if defined?(Synchrony) && HTTPMethods.instance_methods.include?(:aget)
|
31
29
|
# have to make the callbacks fire on the next tick in order
|
32
30
|
# to avoid the dreaded "double resume" exception
|
@@ -100,6 +98,7 @@ if defined?(EventMachine::HttpClient)
|
|
100
98
|
|
101
99
|
if stubbed_webmock_response
|
102
100
|
WebMock::CallbackRegistry.invoke_callbacks({:lib => :em_http_request}, request_signature, stubbed_webmock_response)
|
101
|
+
@uri ||= nil
|
103
102
|
EM.next_tick {
|
104
103
|
setup(make_raw_response(stubbed_webmock_response), @uri,
|
105
104
|
stubbed_webmock_response.should_timeout ? "WebMock timeout error" : nil)
|
@@ -10,13 +10,34 @@ module HTTP
|
|
10
10
|
webmock_response
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
class << self
|
14
|
+
def from_webmock(webmock_response, request_signature = nil)
|
15
|
+
status = Status.new(webmock_response.status.first)
|
16
|
+
headers = webmock_response.headers || {}
|
17
|
+
body = Body.new Streamer.new webmock_response.body
|
18
|
+
uri = normalize_uri(request_signature && request_signature.uri)
|
18
19
|
|
19
|
-
|
20
|
+
return new(status, "1.1", headers, body, uri) if HTTP::VERSION < "1.0.0"
|
21
|
+
|
22
|
+
new({
|
23
|
+
:status => status,
|
24
|
+
:version => "1.1",
|
25
|
+
:headers => headers,
|
26
|
+
:body => body,
|
27
|
+
:uri => uri
|
28
|
+
})
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def normalize_uri(uri)
|
34
|
+
return unless uri
|
35
|
+
|
36
|
+
uri = URI.parse uri
|
37
|
+
uri.port = nil if uri.default_port && uri.port == uri.default_port
|
38
|
+
|
39
|
+
uri
|
40
|
+
end
|
20
41
|
end
|
21
42
|
end
|
22
43
|
end
|
@@ -3,6 +3,7 @@ module HTTP
|
|
3
3
|
def initialize(request, &perform)
|
4
4
|
@request = request
|
5
5
|
@perform = perform
|
6
|
+
@request_signature = nil
|
6
7
|
end
|
7
8
|
|
8
9
|
def exec
|
@@ -33,13 +34,18 @@ module HTTP
|
|
33
34
|
|
34
35
|
return unless webmock_response
|
35
36
|
|
36
|
-
|
37
|
+
raise_timeout_error if webmock_response.should_timeout
|
37
38
|
webmock_response.raise_error_if_any
|
38
39
|
|
39
40
|
invoke_callbacks(webmock_response, :real_request => false)
|
40
41
|
::HTTP::Response.from_webmock webmock_response, request_signature
|
41
42
|
end
|
42
43
|
|
44
|
+
def raise_timeout_error
|
45
|
+
raise Errno::ETIMEDOUT if HTTP::VERSION < "1.0.0"
|
46
|
+
raise HTTP::ConnectionError, "connection error: #{Errno::ETIMEDOUT.new}"
|
47
|
+
end
|
48
|
+
|
43
49
|
def perform
|
44
50
|
return unless ::WebMock.net_connect_allowed?(request_signature.uri)
|
45
51
|
response = @perform.call
|
@@ -1,7 +1,9 @@
|
|
1
1
|
begin
|
2
2
|
require 'httpclient'
|
3
|
+
require 'jsonclient' # defined in 'httpclient' gem as well
|
3
4
|
rescue LoadError
|
4
5
|
# httpclient not found
|
6
|
+
# or jsonclient not defined (in old versions of httclient gem)
|
5
7
|
end
|
6
8
|
|
7
9
|
if defined?(::HTTPClient)
|
@@ -11,26 +13,36 @@ if defined?(::HTTPClient)
|
|
11
13
|
class HTTPClientAdapter < HttpLibAdapter
|
12
14
|
adapter_for :httpclient
|
13
15
|
|
14
|
-
|
16
|
+
unless const_defined?(:OriginalHttpClient)
|
17
|
+
OriginalHttpClient = ::HTTPClient
|
18
|
+
end
|
19
|
+
|
20
|
+
unless const_defined?(:OriginalJsonClient)
|
21
|
+
OriginalJsonClient = ::JSONClient if defined?(::JSONClient)
|
22
|
+
end
|
15
23
|
|
16
24
|
def self.enable!
|
17
25
|
Object.send(:remove_const, :HTTPClient)
|
18
26
|
Object.send(:const_set, :HTTPClient, WebMockHTTPClient)
|
27
|
+
if defined? ::JSONClient
|
28
|
+
Object.send(:remove_const, :JSONClient)
|
29
|
+
Object.send(:const_set, :JSONClient, WebMockJSONClient)
|
30
|
+
end
|
19
31
|
end
|
20
32
|
|
21
33
|
def self.disable!
|
22
34
|
Object.send(:remove_const, :HTTPClient)
|
23
35
|
Object.send(:const_set, :HTTPClient, OriginalHttpClient)
|
36
|
+
if defined? ::JSONClient
|
37
|
+
Object.send(:remove_const, :JSONClient)
|
38
|
+
Object.send(:const_set, :JSONClient, OriginalJsonClient)
|
39
|
+
end
|
24
40
|
end
|
25
41
|
end
|
26
42
|
end
|
27
43
|
end
|
28
44
|
|
29
|
-
|
30
|
-
class WebMockHTTPClient < HTTPClient
|
31
|
-
alias_method :do_get_block_without_webmock, :do_get_block
|
32
|
-
alias_method :do_get_stream_without_webmock, :do_get_stream
|
33
|
-
|
45
|
+
module WebMockHTTPClients
|
34
46
|
def do_get_block(req, proxy, conn, &block)
|
35
47
|
do_get(req, proxy, conn, false, &block)
|
36
48
|
end
|
@@ -105,6 +117,22 @@ if defined?(::HTTPClient)
|
|
105
117
|
end
|
106
118
|
end
|
107
119
|
|
120
|
+
class WebMockHTTPClient < HTTPClient
|
121
|
+
alias_method :do_get_block_without_webmock, :do_get_block
|
122
|
+
alias_method :do_get_stream_without_webmock, :do_get_stream
|
123
|
+
|
124
|
+
include WebMockHTTPClients
|
125
|
+
end
|
126
|
+
|
127
|
+
if defined? ::JSONClient
|
128
|
+
class WebMockJSONClient < JSONClient
|
129
|
+
alias_method :do_get_block_without_webmock, :do_get_block
|
130
|
+
alias_method :do_get_stream_without_webmock, :do_get_stream
|
131
|
+
|
132
|
+
include WebMockHTTPClients
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
108
136
|
def build_webmock_response(httpclient_response)
|
109
137
|
webmock_response = WebMock::Response.new
|
110
138
|
webmock_response.status = [httpclient_response.status, httpclient_response.reason]
|
@@ -210,6 +210,18 @@ module WebMock
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
+
# patch for StringIO behavior in Ruby 2.2.3
|
214
|
+
# https://github.com/bblimke/webmock/issues/558
|
215
|
+
class PatchedStringIO < StringIO #:nodoc:
|
216
|
+
|
217
|
+
alias_method :orig_read_nonblock, :read_nonblock
|
218
|
+
|
219
|
+
def read_nonblock(size, *args)
|
220
|
+
orig_read_nonblock(size)
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
|
213
225
|
class StubSocket #:nodoc:
|
214
226
|
|
215
227
|
attr_accessor :read_timeout, :continue_timeout
|
@@ -235,10 +247,12 @@ module Net #:nodoc: all
|
|
235
247
|
@debug_output = debug_output
|
236
248
|
|
237
249
|
@io = case io
|
238
|
-
when Socket, OpenSSL::SSL::SSLSocket, IO
|
250
|
+
when Socket, OpenSSL::SSL::SSLSocket, IO
|
239
251
|
io
|
252
|
+
when StringIO
|
253
|
+
PatchedStringIO.new(io.string)
|
240
254
|
when String
|
241
|
-
|
255
|
+
PatchedStringIO.new(io)
|
242
256
|
end
|
243
257
|
raise "Unable to create local socket" unless @io
|
244
258
|
end
|
@@ -34,26 +34,26 @@ module WebMock
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def description
|
37
|
-
"request #{request_pattern
|
37
|
+
"request #{request_pattern} #{quantity_phrase.strip}"
|
38
38
|
end
|
39
39
|
|
40
40
|
def failure_message
|
41
|
-
failure_message_phrase(
|
41
|
+
failure_message_phrase(false)
|
42
42
|
end
|
43
43
|
|
44
44
|
def failure_message_when_negated
|
45
|
-
failure_message_phrase(
|
45
|
+
failure_message_phrase(true)
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.executed_requests_message
|
49
|
-
"\n\nThe following requests were made:\n\n#{RequestRegistry.instance
|
49
|
+
"\n\nThe following requests were made:\n\n#{RequestRegistry.instance}\n" + "="*60
|
50
50
|
end
|
51
51
|
|
52
52
|
private
|
53
53
|
|
54
54
|
def failure_message_phrase(is_negated=false)
|
55
55
|
negation = is_negated ? "was not" : "was"
|
56
|
-
text = "The request #{request_pattern
|
56
|
+
text = "The request #{request_pattern} #{negation} expected to execute #{quantity_phrase(is_negated)}but it executed #{times(times_executed)}"
|
57
57
|
text << self.class.executed_requests_message
|
58
58
|
text
|
59
59
|
end
|
data/lib/webmock/response.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require "pathname"
|
2
2
|
|
3
3
|
#compatibility with Ruby 1.9.2 preview1 to allow reading raw responses
|
4
|
-
|
5
|
-
|
4
|
+
if RUBY_VERSION <= "1.9.2"
|
5
|
+
class StringIO
|
6
|
+
alias_method :read_nonblock, :sysread
|
7
|
+
end
|
6
8
|
end
|
7
9
|
|
8
10
|
module WebMock
|
data/lib/webmock/version.rb
CHANGED
@@ -82,7 +82,6 @@ unless RUBY_PLATFORM =~ /java/
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should call on_body for each chunk with chunked response" do
|
85
|
-
body = "on_body fired"
|
86
85
|
stub_request(:any, "example.com").
|
87
86
|
to_return(:body => ["first_chunk", "second_chunk"],
|
88
87
|
:headers => {"Transfer-Encoding" => "chunked"})
|
@@ -287,7 +286,6 @@ unless RUBY_PLATFORM =~ /java/
|
|
287
286
|
|
288
287
|
context "when response does not include Content-Type header" do
|
289
288
|
it "returns nil for content_type" do
|
290
|
-
content_type = "application/json"
|
291
289
|
|
292
290
|
stub_request(:any, 'example.com').
|
293
291
|
to_return(:body => "abc",
|
@@ -164,7 +164,7 @@ unless RUBY_PLATFORM =~ /java/
|
|
164
164
|
expect {
|
165
165
|
EM.run do
|
166
166
|
fiber = Fiber.new do
|
167
|
-
|
167
|
+
EM::HttpRequest.new("http://www.testserver.com").post :body => "foo=bar&baz=bang", :timeout => 60
|
168
168
|
EM.stop
|
169
169
|
end
|
170
170
|
fiber.resume
|
@@ -48,12 +48,26 @@ describe "HTTP.rb" do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
context "restored request uri on replayed response object" do
|
52
|
+
it "keeps non-default port" do
|
53
|
+
stub_request :get, "example.com:1234/foo"
|
54
|
+
response = HTTP.get "http://example.com:1234/foo"
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
+
expect(response.uri.to_s).to eq "http://example.com:1234/foo"
|
57
|
+
end
|
58
|
+
|
59
|
+
it "does not injects default port" do
|
60
|
+
stub_request :get, "example.com/foo"
|
61
|
+
response = HTTP.get "http://example.com/foo"
|
62
|
+
|
63
|
+
expect(response.uri.to_s).to eq "http://example.com/foo"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "strips out default port even if it was explicitly given" do
|
67
|
+
stub_request :get, "example.com/foo"
|
68
|
+
response = HTTP.get "http://example.com:80/foo"
|
56
69
|
|
57
|
-
|
70
|
+
expect(response.uri.to_s).to eq "http://example.com/foo"
|
71
|
+
end
|
58
72
|
end
|
59
73
|
end
|
@@ -13,11 +13,13 @@ module HttpRbSpecHelper
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def client_timeout_exception_class
|
16
|
-
Errno::ETIMEDOUT
|
16
|
+
return Errno::ETIMEDOUT if HTTP::VERSION < "1.0.0"
|
17
|
+
HTTP::ConnectionError
|
17
18
|
end
|
18
19
|
|
19
20
|
def connection_refused_exception_class
|
20
|
-
Errno::ECONNREFUSED
|
21
|
+
return Errno::ECONNREFUSED if HTTP::VERSION < "1.0.0"
|
22
|
+
HTTP::ConnectionError
|
21
23
|
end
|
22
24
|
|
23
25
|
def http_library
|
@@ -47,6 +47,16 @@ describe "HTTPClient" do
|
|
47
47
|
expect(str).to eq('test')
|
48
48
|
end
|
49
49
|
|
50
|
+
it "should work via JSONClient subclass" do
|
51
|
+
stub_request(:get, 'www.example.com').to_return(
|
52
|
+
:status => 200,
|
53
|
+
:body => '{"test": "foo"}',
|
54
|
+
:headers => {'Content-Type' => 'application/json'}
|
55
|
+
)
|
56
|
+
content = JSONClient.get('www.example.com').content
|
57
|
+
expect(content).to eq("test" => "foo")
|
58
|
+
end
|
59
|
+
|
50
60
|
context "multipart bodies" do
|
51
61
|
let(:header) {{
|
52
62
|
'Accept' => 'application/json',
|
@@ -228,12 +228,12 @@ describe "Net:HTTP" do
|
|
228
228
|
|
229
229
|
it "should connect to the server if the URI matches an regex", :net_connect => true do
|
230
230
|
WebMock.disable_net_connect!(:allow => /google.com/)
|
231
|
-
|
231
|
+
Net::HTTP.get('www.google.com','/')
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should connect to the server if the URI matches any regex the array", :net_connect => true do
|
235
235
|
WebMock.disable_net_connect!(:allow => [/google.com/, /yahoo.com/])
|
236
|
-
|
236
|
+
Net::HTTP.get('www.google.com','/')
|
237
237
|
end
|
238
238
|
|
239
239
|
end
|
@@ -24,14 +24,13 @@ unless RUBY_PLATFORM =~ /java/
|
|
24
24
|
before(:each) do
|
25
25
|
@dir_path = Dir.mktmpdir('webmock-')
|
26
26
|
@file_path = File.join(@dir_path, "webmock_temp_test_file")
|
27
|
-
FileUtils.rm_rf(@file_path) if File.
|
27
|
+
FileUtils.rm_rf(@file_path) if File.exist?(@file_path)
|
28
28
|
end
|
29
29
|
|
30
30
|
after(:each) do
|
31
31
|
FileUtils.rm_rf(@dir_path) if File.exist?(@dir_path)
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
34
|
it "should work with get_file" do
|
36
35
|
stub_request(:get, "www.example.com").to_return(:body => "abc")
|
37
36
|
@sess.get_file("/", @file_path)
|
@@ -115,7 +114,6 @@ unless RUBY_PLATFORM =~ /java/
|
|
115
114
|
stub_request(:get, "www.example.com").
|
116
115
|
to_return(:body => "<?xml encoding=\"iso-8859-1\">Øl</xml>".encode("iso-8859-1"))
|
117
116
|
|
118
|
-
|
119
117
|
expect(@sess.get("").body.encoding).to eq(Encoding::ISO_8859_1)
|
120
118
|
end
|
121
119
|
|
@@ -11,8 +11,17 @@ shared_context "allowing and disabling net connect" do |*adapter_info|
|
|
11
11
|
|
12
12
|
it "should make a real https request if request is not stubbed" do
|
13
13
|
unless http_library == :httpclient
|
14
|
-
|
15
|
-
|
14
|
+
result = http_request(:get, "https://www.google.com/").body
|
15
|
+
if result.respond_to? :encode
|
16
|
+
result = result.encode(
|
17
|
+
'UTF-8',
|
18
|
+
'binary',
|
19
|
+
:invalid => :replace,
|
20
|
+
:undef => :replace,
|
21
|
+
:replace => ''
|
22
|
+
)
|
23
|
+
end
|
24
|
+
expect(result).to match(/.*google.*/)
|
16
25
|
end
|
17
26
|
end
|
18
27
|
|
@@ -24,8 +24,8 @@ describe WebMock::RackResponse do
|
|
24
24
|
|
25
25
|
it "should shouldn't blow up when hitting a locked resource twice" do
|
26
26
|
@locked_rack_response = WebMock::RackResponse.new(MyLockedRackApp)
|
27
|
-
request
|
28
|
-
|
27
|
+
request = WebMock::RequestSignature.new(:get, 'www.example.com/locked')
|
28
|
+
@locked_rack_response.evaluate(request)
|
29
29
|
response2 = @locked_rack_response.evaluate(request)
|
30
30
|
|
31
31
|
expect(response2.body).to include('Single threaded response.')
|
data/webmock.gemspec
CHANGED
@@ -15,12 +15,14 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.rubyforge_project = 'webmock'
|
17
17
|
|
18
|
-
|
18
|
+
patron_version = (RUBY_VERSION <= '1.8.7') ? '0.4.18' : '>= 0.4.18'
|
19
|
+
addressable_version = (RUBY_VERSION) > '1.8.7' ? '>= 2.3.6' : '< 2.4.0'
|
20
|
+
manticore_version = (RUBY_VERSION) > '1.8.7' ? '>= 0.5.1' : '<= 0.5.1'
|
21
|
+
|
22
|
+
s.add_dependency 'addressable', addressable_version
|
19
23
|
s.add_dependency 'crack', '>=0.3.2'
|
20
24
|
s.add_dependency 'hashdiff'
|
21
25
|
|
22
|
-
patron_version = (RUBY_VERSION <= '1.8.7') ? '0.4.18' : '>= 0.4.18'
|
23
|
-
|
24
26
|
s.add_development_dependency 'rspec', '>= 3.1.0'
|
25
27
|
s.add_development_dependency 'httpclient', '>= 2.2.4'
|
26
28
|
s.add_development_dependency('patron', patron_version) unless RUBY_PLATFORM =~ /java/
|
@@ -29,7 +31,7 @@ Gem::Specification.new do |s|
|
|
29
31
|
s.add_development_dependency 'em-synchrony', '>= 1.0.0' if RUBY_VERSION >= "1.9"
|
30
32
|
s.add_development_dependency 'curb', '<= 0.8.6' unless RUBY_PLATFORM =~ /java/
|
31
33
|
s.add_development_dependency 'typhoeus', '>= 0.5.0' unless RUBY_PLATFORM =~ /java/
|
32
|
-
s.add_development_dependency
|
34
|
+
s.add_development_dependency('manticore', manticore_version) if RUBY_PLATFORM =~ /java/
|
33
35
|
s.add_development_dependency 'excon', '>= 0.27.5'
|
34
36
|
s.add_development_dependency 'minitest', '~> 5.0.0'
|
35
37
|
s.add_development_dependency 'rdoc', ((RUBY_VERSION == '1.8.6') ? '<= 3.5.0' : '>3.5.0')
|
metadata
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 22
|
9
|
-
- 3
|
10
|
-
version: 1.22.3
|
4
|
+
version: 1.22.5
|
11
5
|
platform: ruby
|
12
6
|
authors:
|
13
7
|
- Bartosz Blimke
|
@@ -15,229 +9,147 @@ autorequire:
|
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
11
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
12
|
+
date: 2016-01-05 00:00:00 Z
|
20
13
|
dependencies:
|
21
14
|
- !ruby/object:Gem::Dependency
|
22
|
-
type: :runtime
|
23
15
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
16
|
requirements:
|
26
|
-
- -
|
17
|
+
- - <
|
27
18
|
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
- 2
|
31
|
-
- 3
|
32
|
-
- 6
|
33
|
-
version: 2.3.6
|
19
|
+
version: 2.4.0
|
20
|
+
name: addressable
|
34
21
|
prerelease: false
|
35
22
|
requirement: *id001
|
36
|
-
name: addressable
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
23
|
type: :runtime
|
24
|
+
- !ruby/object:Gem::Dependency
|
39
25
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
26
|
requirements:
|
42
27
|
- - ">="
|
43
28
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 23
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 3
|
48
|
-
- 2
|
49
29
|
version: 0.3.2
|
30
|
+
name: crack
|
50
31
|
prerelease: false
|
51
32
|
requirement: *id002
|
52
|
-
name: crack
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
33
|
type: :runtime
|
34
|
+
- !ruby/object:Gem::Dependency
|
55
35
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
36
|
requirements:
|
58
|
-
-
|
37
|
+
- &id014
|
38
|
+
- ">="
|
59
39
|
- !ruby/object:Gem::Version
|
60
|
-
hash: 3
|
61
|
-
segments:
|
62
|
-
- 0
|
63
40
|
version: "0"
|
41
|
+
name: hashdiff
|
64
42
|
prerelease: false
|
65
43
|
requirement: *id003
|
66
|
-
|
44
|
+
type: :runtime
|
67
45
|
- !ruby/object:Gem::Dependency
|
68
|
-
type: :development
|
69
46
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
47
|
requirements:
|
72
48
|
- - ">="
|
73
49
|
- !ruby/object:Gem::Version
|
74
|
-
hash: 3
|
75
|
-
segments:
|
76
|
-
- 3
|
77
|
-
- 1
|
78
|
-
- 0
|
79
50
|
version: 3.1.0
|
51
|
+
name: rspec
|
80
52
|
prerelease: false
|
81
53
|
requirement: *id004
|
82
|
-
name: rspec
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
54
|
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
85
56
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
57
|
requirements:
|
88
58
|
- - ">="
|
89
59
|
- !ruby/object:Gem::Version
|
90
|
-
hash: 15
|
91
|
-
segments:
|
92
|
-
- 2
|
93
|
-
- 2
|
94
|
-
- 4
|
95
60
|
version: 2.2.4
|
61
|
+
name: httpclient
|
96
62
|
prerelease: false
|
97
63
|
requirement: *id005
|
98
|
-
name: httpclient
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
64
|
type: :development
|
65
|
+
- !ruby/object:Gem::Dependency
|
101
66
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
67
|
requirements:
|
104
68
|
- - "="
|
105
69
|
- !ruby/object:Gem::Version
|
106
|
-
hash: 43
|
107
|
-
segments:
|
108
|
-
- 0
|
109
|
-
- 4
|
110
|
-
- 18
|
111
70
|
version: 0.4.18
|
71
|
+
name: patron
|
112
72
|
prerelease: false
|
113
73
|
requirement: *id006
|
114
|
-
name: patron
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
74
|
type: :development
|
75
|
+
- !ruby/object:Gem::Dependency
|
117
76
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
77
|
requirements:
|
120
78
|
- - ">="
|
121
79
|
- !ruby/object:Gem::Version
|
122
|
-
hash: 19
|
123
|
-
segments:
|
124
|
-
- 1
|
125
|
-
- 0
|
126
|
-
- 2
|
127
80
|
version: 1.0.2
|
81
|
+
name: em-http-request
|
128
82
|
prerelease: false
|
129
83
|
requirement: *id007
|
130
|
-
name: em-http-request
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
84
|
type: :development
|
85
|
+
- !ruby/object:Gem::Dependency
|
133
86
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
134
|
-
none: false
|
135
87
|
requirements:
|
136
88
|
- - "="
|
137
89
|
- !ruby/object:Gem::Version
|
138
|
-
hash: 5
|
139
|
-
segments:
|
140
|
-
- 0
|
141
|
-
- 7
|
142
|
-
- 3
|
143
90
|
version: 0.7.3
|
91
|
+
name: http
|
144
92
|
prerelease: false
|
145
93
|
requirement: *id008
|
146
|
-
name: http
|
147
|
-
- !ruby/object:Gem::Dependency
|
148
94
|
type: :development
|
95
|
+
- !ruby/object:Gem::Dependency
|
149
96
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
150
|
-
none: false
|
151
97
|
requirements:
|
152
98
|
- - <=
|
153
99
|
- !ruby/object:Gem::Version
|
154
|
-
hash: 51
|
155
|
-
segments:
|
156
|
-
- 0
|
157
|
-
- 8
|
158
|
-
- 6
|
159
100
|
version: 0.8.6
|
101
|
+
name: curb
|
160
102
|
prerelease: false
|
161
103
|
requirement: *id009
|
162
|
-
name: curb
|
163
|
-
- !ruby/object:Gem::Dependency
|
164
104
|
type: :development
|
105
|
+
- !ruby/object:Gem::Dependency
|
165
106
|
version_requirements: &id010 !ruby/object:Gem::Requirement
|
166
|
-
none: false
|
167
107
|
requirements:
|
168
108
|
- - ">="
|
169
109
|
- !ruby/object:Gem::Version
|
170
|
-
hash: 11
|
171
|
-
segments:
|
172
|
-
- 0
|
173
|
-
- 5
|
174
|
-
- 0
|
175
110
|
version: 0.5.0
|
111
|
+
name: typhoeus
|
176
112
|
prerelease: false
|
177
113
|
requirement: *id010
|
178
|
-
name: typhoeus
|
179
|
-
- !ruby/object:Gem::Dependency
|
180
114
|
type: :development
|
115
|
+
- !ruby/object:Gem::Dependency
|
181
116
|
version_requirements: &id011 !ruby/object:Gem::Requirement
|
182
|
-
none: false
|
183
117
|
requirements:
|
184
118
|
- - ">="
|
185
119
|
- !ruby/object:Gem::Version
|
186
|
-
hash: 121
|
187
|
-
segments:
|
188
|
-
- 0
|
189
|
-
- 27
|
190
|
-
- 5
|
191
120
|
version: 0.27.5
|
121
|
+
name: excon
|
192
122
|
prerelease: false
|
193
123
|
requirement: *id011
|
194
|
-
name: excon
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
124
|
type: :development
|
125
|
+
- !ruby/object:Gem::Dependency
|
197
126
|
version_requirements: &id012 !ruby/object:Gem::Requirement
|
198
|
-
none: false
|
199
127
|
requirements:
|
200
128
|
- - ~>
|
201
129
|
- !ruby/object:Gem::Version
|
202
|
-
hash: 55
|
203
|
-
segments:
|
204
|
-
- 5
|
205
|
-
- 0
|
206
|
-
- 0
|
207
130
|
version: 5.0.0
|
131
|
+
name: minitest
|
208
132
|
prerelease: false
|
209
133
|
requirement: *id012
|
210
|
-
name: minitest
|
211
|
-
- !ruby/object:Gem::Dependency
|
212
134
|
type: :development
|
135
|
+
- !ruby/object:Gem::Dependency
|
213
136
|
version_requirements: &id013 !ruby/object:Gem::Requirement
|
214
|
-
none: false
|
215
137
|
requirements:
|
216
138
|
- - ">"
|
217
139
|
- !ruby/object:Gem::Version
|
218
|
-
hash: 19
|
219
|
-
segments:
|
220
|
-
- 3
|
221
|
-
- 5
|
222
|
-
- 0
|
223
140
|
version: 3.5.0
|
141
|
+
name: rdoc
|
224
142
|
prerelease: false
|
225
143
|
requirement: *id013
|
226
|
-
name: rdoc
|
227
|
-
- !ruby/object:Gem::Dependency
|
228
144
|
type: :development
|
229
|
-
|
230
|
-
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
version_requirements: &id015 !ruby/object:Gem::Requirement
|
231
147
|
requirements:
|
232
|
-
-
|
233
|
-
- !ruby/object:Gem::Version
|
234
|
-
hash: 3
|
235
|
-
segments:
|
236
|
-
- 0
|
237
|
-
version: "0"
|
238
|
-
prerelease: false
|
239
|
-
requirement: *id014
|
148
|
+
- *id014
|
240
149
|
name: rack
|
150
|
+
prerelease: false
|
151
|
+
requirement: *id015
|
152
|
+
type: :development
|
241
153
|
description: WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.
|
242
154
|
email:
|
243
155
|
- bartosz.blimke@gmail.com
|
@@ -380,39 +292,28 @@ files:
|
|
380
292
|
- test/test_helper.rb
|
381
293
|
- test/test_webmock.rb
|
382
294
|
- webmock.gemspec
|
383
|
-
has_rdoc: true
|
384
295
|
homepage: http://github.com/bblimke/webmock
|
385
296
|
licenses:
|
386
297
|
- MIT
|
298
|
+
metadata: {}
|
299
|
+
|
387
300
|
post_install_message:
|
388
301
|
rdoc_options: []
|
389
302
|
|
390
303
|
require_paths:
|
391
304
|
- lib
|
392
305
|
required_ruby_version: !ruby/object:Gem::Requirement
|
393
|
-
none: false
|
394
306
|
requirements:
|
395
|
-
-
|
396
|
-
- !ruby/object:Gem::Version
|
397
|
-
hash: 3
|
398
|
-
segments:
|
399
|
-
- 0
|
400
|
-
version: "0"
|
307
|
+
- *id014
|
401
308
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
402
|
-
none: false
|
403
309
|
requirements:
|
404
|
-
-
|
405
|
-
- !ruby/object:Gem::Version
|
406
|
-
hash: 3
|
407
|
-
segments:
|
408
|
-
- 0
|
409
|
-
version: "0"
|
310
|
+
- *id014
|
410
311
|
requirements: []
|
411
312
|
|
412
313
|
rubyforge_project: webmock
|
413
|
-
rubygems_version:
|
314
|
+
rubygems_version: 2.0.17
|
414
315
|
signing_key:
|
415
|
-
specification_version:
|
316
|
+
specification_version: 4
|
416
317
|
summary: Library for stubbing HTTP requests in Ruby.
|
417
318
|
test_files:
|
418
319
|
- spec/acceptance/curb/curb_spec.rb
|