webmock 1.6.4 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +3 -1
- data/.travis.yml +6 -0
- data/CHANGELOG.md +211 -118
- data/Gemfile +16 -1
- data/Guardfile +24 -0
- data/LICENSE +1 -1
- data/README.md +64 -15
- data/Rakefile +19 -6
- data/lib/webmock.rb +9 -4
- data/lib/webmock/api.rb +5 -4
- data/lib/webmock/assertion_failure.rb +1 -1
- data/lib/webmock/callback_registry.rb +1 -1
- data/lib/webmock/config.rb +2 -2
- data/lib/webmock/cucumber.rb +1 -1
- data/lib/webmock/errors.rb +17 -5
- data/lib/webmock/http_lib_adapters/{curb.rb → curb_adapter.rb} +79 -49
- data/lib/webmock/http_lib_adapters/{em_http_request.rb → em_http_request/em_http_request_0_x.rb} +20 -15
- data/lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb +201 -0
- data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +11 -0
- data/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
- data/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
- data/lib/webmock/http_lib_adapters/{httpclient.rb → httpclient_adapter.rb} +35 -8
- data/lib/webmock/http_lib_adapters/net_http.rb +84 -25
- data/lib/webmock/http_lib_adapters/net_http_response.rb +17 -17
- data/lib/webmock/http_lib_adapters/patron_adapter.rb +124 -0
- data/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +166 -0
- data/lib/webmock/minitest.rb +15 -0
- data/lib/webmock/rack_response.rb +52 -0
- data/lib/webmock/request_pattern.rb +4 -2
- data/lib/webmock/request_signature.rb +4 -0
- data/lib/webmock/request_stub.rb +35 -2
- data/lib/webmock/responses_sequence.rb +2 -2
- data/lib/webmock/rspec.rb +2 -2
- data/lib/webmock/rspec/matchers.rb +9 -4
- data/lib/webmock/rspec/matchers/webmock_matcher.rb +1 -1
- data/lib/webmock/stub_registry.rb +1 -1
- data/lib/webmock/stub_request_snippet.rb +14 -11
- data/lib/webmock/util/hash_keys_stringifier.rb +4 -4
- data/lib/webmock/util/headers.rb +3 -3
- data/lib/webmock/util/json.rb +54 -0
- data/lib/webmock/util/uri.rb +1 -1
- data/lib/webmock/version.rb +1 -1
- data/lib/webmock/webmock.rb +20 -3
- data/minitest/test_helper.rb +29 -0
- data/minitest/test_webmock.rb +6 -0
- data/minitest/webmock_spec.rb +30 -0
- data/spec/curb_spec.rb +26 -8
- data/spec/curb_spec_helper.rb +6 -6
- data/spec/em_http_request_spec.rb +95 -1
- data/spec/em_http_request_spec_helper.rb +16 -16
- data/spec/errors_spec.rb +19 -4
- data/spec/example_curl_output.txt +22 -22
- data/spec/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
- data/spec/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
- data/spec/httpclient_spec.rb +1 -1
- data/spec/httpclient_spec_helper.rb +3 -38
- data/spec/my_rack_app.rb +18 -0
- data/spec/net_http_shared.rb +125 -0
- data/spec/net_http_spec.rb +27 -31
- data/spec/net_http_spec_helper.rb +4 -34
- data/spec/network_connection.rb +1 -1
- data/spec/patron_spec_helper.rb +4 -7
- data/spec/quality_spec.rb +60 -0
- data/spec/rack_response_spec.rb +33 -0
- data/spec/real_net_http_spec.rb +20 -0
- data/spec/request_execution_verifier_spec.rb +8 -8
- data/spec/request_pattern_spec.rb +3 -3
- data/spec/request_stub_spec.rb +19 -19
- data/spec/response_spec.rb +8 -8
- data/spec/spec_helper.rb +14 -11
- data/spec/stub_request_snippet_spec.rb +85 -37
- data/spec/support/webmock_server.rb +62 -0
- data/spec/typhoeus_hydra_spec.rb +53 -0
- data/spec/typhoeus_hydra_spec_helper.rb +50 -0
- data/spec/util/headers_spec.rb +5 -5
- data/spec/util/json_spec.rb +7 -0
- data/spec/util/uri_spec.rb +1 -1
- data/spec/vendor/addressable/lib/uri.rb +1 -0
- data/spec/vendor/crack/lib/crack.rb +1 -0
- data/spec/vendor/right_http_connection-1.2.4/History.txt +4 -4
- data/spec/vendor/right_http_connection-1.2.4/README.txt +4 -4
- data/spec/vendor/right_http_connection-1.2.4/Rakefile +3 -3
- data/spec/vendor/right_http_connection-1.2.4/lib/net_fix.rb +4 -4
- data/spec/vendor/right_http_connection-1.2.4/setup.rb +4 -4
- data/spec/webmock_shared.rb +375 -143
- data/spec/webmock_spec.rb +7 -0
- data/test/http_request.rb +24 -0
- data/test/shared_test.rb +47 -0
- data/test/test_helper.rb +6 -3
- data/test/test_webmock.rb +2 -67
- data/webmock.gemspec +8 -7
- metadata +153 -88
- data/lib/webmock/http_lib_adapters/patron.rb +0 -100
- data/spec/other_net_http_libs_spec.rb +0 -30
data/spec/response_spec.rb
CHANGED
@@ -139,14 +139,14 @@ describe WebMock::Response do
|
|
139
139
|
@response.headers.should == {
|
140
140
|
"Date"=>"Sat, 23 Jan 2010 01:01:05 GMT",
|
141
141
|
"Content-Type"=>"text/html; charset=UTF-8",
|
142
|
-
"Content-Length"=>"
|
142
|
+
"Content-Length"=>"419",
|
143
143
|
"Connection"=>"Keep-Alive",
|
144
144
|
"Accept"=>"image/jpeg, image/png"
|
145
145
|
}
|
146
146
|
end
|
147
147
|
|
148
148
|
it "should read body" do
|
149
|
-
@response.body.size.should ==
|
149
|
+
@response.body.size.should == 419
|
150
150
|
end
|
151
151
|
|
152
152
|
it "should close IO" do
|
@@ -169,20 +169,20 @@ describe WebMock::Response do
|
|
169
169
|
@response.headers.should == {
|
170
170
|
"Date"=>"Sat, 23 Jan 2010 01:01:05 GMT",
|
171
171
|
"Content-Type"=>"text/html; charset=UTF-8",
|
172
|
-
"Content-Length"=>"
|
172
|
+
"Content-Length"=>"419",
|
173
173
|
"Connection"=>"Keep-Alive",
|
174
174
|
"Accept"=>"image/jpeg, image/png"
|
175
175
|
}
|
176
176
|
end
|
177
177
|
|
178
178
|
it "should read body" do
|
179
|
-
@response.body.size.should ==
|
179
|
+
@response.body.size.should == 419
|
180
180
|
end
|
181
181
|
|
182
182
|
it "should work with transfer-encoding set to chunked" do
|
183
|
-
@input.gsub!("Content-Length:
|
183
|
+
@input.gsub!("Content-Length: 419", "Transfer-Encoding: chunked")
|
184
184
|
@response = WebMock::Response.new(@input)
|
185
|
-
@response.body.size.should ==
|
185
|
+
@response.body.size.should == 419
|
186
186
|
end
|
187
187
|
|
188
188
|
end
|
@@ -249,14 +249,14 @@ describe WebMock::Response do
|
|
249
249
|
describe "as a file" do
|
250
250
|
it "should return response" do
|
251
251
|
response = WebMock::DynamicResponse.new(lambda {|request| @files[request.uri.host.to_s] })
|
252
|
-
response.evaluate(@request_signature).body.size.should ==
|
252
|
+
response.evaluate(@request_signature).body.size.should == 419
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
256
256
|
describe "as a string" do
|
257
257
|
it "should return response" do
|
258
258
|
response = WebMock::DynamicResponse.new(lambda {|request| @files[request.uri.host.to_s].read })
|
259
|
-
response.evaluate(@request_signature).body.size.should ==
|
259
|
+
response.evaluate(@request_signature).body.size.should == 419
|
260
260
|
end
|
261
261
|
end
|
262
262
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,8 +2,9 @@ require 'rubygems'
|
|
2
2
|
require 'httpclient'
|
3
3
|
unless RUBY_PLATFORM =~ /java/
|
4
4
|
require 'curb'
|
5
|
-
require 'patron'
|
5
|
+
require 'patron'
|
6
6
|
require 'em-http'
|
7
|
+
require 'typhoeus'
|
7
8
|
end
|
8
9
|
|
9
10
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
@@ -13,9 +14,10 @@ require 'rspec'
|
|
13
14
|
require 'webmock/rspec'
|
14
15
|
|
15
16
|
require 'network_connection'
|
17
|
+
require 'support/webmock_server'
|
18
|
+
require 'my_rack_app'
|
16
19
|
|
17
20
|
RSpec.configure do |config|
|
18
|
-
config.include WebMock::API
|
19
21
|
unless NetworkConnection.is_network_available?
|
20
22
|
warn("No network connectivity. Only examples which do not make real network connections will run.")
|
21
23
|
no_network_connection = true
|
@@ -24,6 +26,16 @@ RSpec.configure do |config|
|
|
24
26
|
config.filter_run_excluding :net_connect => true
|
25
27
|
end
|
26
28
|
|
29
|
+
config.filter_run_excluding :without_webmock => true
|
30
|
+
|
31
|
+
config.before(:all) do
|
32
|
+
WebMockServer.instance.start
|
33
|
+
end
|
34
|
+
|
35
|
+
config.after(:all) do
|
36
|
+
WebMockServer.instance.stop
|
37
|
+
end
|
38
|
+
|
27
39
|
config.filter_run :focus => true
|
28
40
|
config.run_all_when_everything_filtered = true
|
29
41
|
end
|
@@ -41,12 +53,3 @@ class Proc
|
|
41
53
|
lambda { self.call }.should_not raise_error
|
42
54
|
end
|
43
55
|
end
|
44
|
-
|
45
|
-
def setup_expectations_for_real_example_com_request(options = {})
|
46
|
-
defaults = { :host => "www.example.com", :port => 80, :method => "GET",
|
47
|
-
:path => "/",
|
48
|
-
:response_code => 302, :response_message => "Found",
|
49
|
-
:response_body => "" }
|
50
|
-
setup_expectations_for_real_request(defaults.merge(options))
|
51
|
-
end
|
52
|
-
|
@@ -2,46 +2,94 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
describe WebMock::StubRequestSnippet do
|
4
4
|
describe "to_s" do
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
describe "GET" do
|
6
|
+
before(:each) do
|
7
|
+
@request_signature = WebMock::RequestSignature.new(:get, "www.example.com/?a=b&c=d", :headers => {})
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
it "should print stub request snippet with url with params and method and empty successful response" do
|
11
|
+
expected = %Q(stub_request(:get, "http://www.example.com/?a=b&c=d").\n to_return(:status => 200, :body => "", :headers => {}))
|
12
|
+
@request_stub = WebMock::RequestStub.from_request_signature(@request_signature)
|
13
|
+
WebMock::StubRequestSnippet.new(@request_stub).to_s.should == expected
|
14
|
+
end
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
16
|
+
it "should print stub request snippet with body if available" do
|
17
|
+
@request_signature.body = "abcdef"
|
18
|
+
expected = %Q(stub_request(:get, "http://www.example.com/?a=b&c=d").)+
|
19
|
+
"\n with(:body => \"abcdef\")." +
|
20
|
+
"\n to_return(:status => 200, :body => \"\", :headers => {})"
|
21
|
+
@request_stub = WebMock::RequestStub.from_request_signature(@request_signature)
|
22
|
+
WebMock::StubRequestSnippet.new(@request_stub).to_s.should == expected
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should print stub request snippet with multiline body" do
|
26
|
+
@request_signature.body = "abc\ndef"
|
27
|
+
expected = %Q(stub_request(:get, "http://www.example.com/?a=b&c=d").)+
|
28
|
+
"\n with(:body => \"abc\\ndef\")." +
|
29
|
+
"\n to_return(:status => 200, :body => \"\", :headers => {})"
|
30
|
+
@request_stub = WebMock::RequestStub.from_request_signature(@request_signature)
|
31
|
+
WebMock::StubRequestSnippet.new(@request_stub).to_s.should == expected
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should print stub request snippet with headers if any" do
|
35
|
+
@request_signature.headers = {'B' => 'b', 'A' => 'a'}
|
36
|
+
expected = 'stub_request(:get, "http://www.example.com/?a=b&c=d").'+
|
37
|
+
"\n with(:headers => {\'A\'=>\'a\', \'B\'=>\'b\'})." +
|
38
|
+
"\n to_return(:status => 200, :body => \"\", :headers => {})"
|
39
|
+
@request_stub = WebMock::RequestStub.from_request_signature(@request_signature)
|
40
|
+
WebMock::StubRequestSnippet.new(@request_stub).to_s.should == expected
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should print stub request snippet with body and headers" do
|
44
|
+
@request_signature.body = "abcdef"
|
45
|
+
@request_signature.headers = {'B' => 'b', 'A' => 'a'}
|
46
|
+
expected = 'stub_request(:get, "http://www.example.com/?a=b&c=d").'+
|
47
|
+
"\n with(:body => \"abcdef\",\n :headers => {\'A\'=>\'a\', \'B\'=>\'b\'})." +
|
48
|
+
"\n to_return(:status => 200, :body => \"\", :headers => {})"
|
49
|
+
@request_stub = WebMock::RequestStub.from_request_signature(@request_signature)
|
50
|
+
WebMock::StubRequestSnippet.new(@request_stub).to_s.should == expected
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should not print to_return part if not wanted" do
|
54
|
+
expected = 'stub_request(:get, "http://www.example.com/").'+
|
55
|
+
"\n with(:body => \"abcdef\")"
|
56
|
+
stub = WebMock::RequestStub.new(:get, "www.example.com").with(:body => "abcdef").to_return(:body => "hello")
|
57
|
+
WebMock::StubRequestSnippet.new(stub).to_s(false).should == expected
|
58
|
+
end
|
36
59
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
60
|
+
|
61
|
+
describe "POST" do
|
62
|
+
let(:form_body) { 'user%5bfirst_name%5d=Bartosz' }
|
63
|
+
let(:multipart_form_body) { 'complicated stuff--ABC123--goes here' }
|
64
|
+
it "should print stub request snippet with body as a hash using rails conventions on form posts" do
|
65
|
+
@request_signature = WebMock::RequestSignature.new(:post, "www.example.com",
|
66
|
+
:headers => {'Content-Type' => 'application/x-www-form-urlencoded'},
|
67
|
+
:body => form_body)
|
68
|
+
@request_stub = WebMock::RequestStub.from_request_signature(@request_signature)
|
69
|
+
expected = <<-STUB
|
70
|
+
stub_request(:post, "http://www.example.com/").
|
71
|
+
with(:body => {"user"=>{"first_name"=>"Bartosz"}},
|
72
|
+
:headers => {'Content-Type'=>'application/x-www-form-urlencoded'}).
|
73
|
+
to_return(:status => 200, :body => \"\", :headers => {})
|
74
|
+
STUB
|
75
|
+
WebMock::StubRequestSnippet.new(@request_stub).to_s.should == expected.strip
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should print stub request snippet leaving body as string when not a urlencoded form" do
|
79
|
+
@request_signature = WebMock::RequestSignature.new(:post, "www.example.com",
|
80
|
+
:headers => {'Content-Type' => 'multipart/form-data; boundary=ABC123'},
|
81
|
+
:body => multipart_form_body)
|
82
|
+
@request_stub = WebMock::RequestStub.from_request_signature(@request_signature)
|
83
|
+
expected = <<-STUB
|
84
|
+
stub_request(:post, "http://www.example.com/").
|
85
|
+
with(:body => "#{multipart_form_body}",
|
86
|
+
:headers => {'Content-Type'=>'multipart/form-data; boundary=ABC123'}).
|
87
|
+
to_return(:status => 200, :body => \"\", :headers => {})
|
88
|
+
STUB
|
89
|
+
WebMock::StubRequestSnippet.new(@request_stub).to_s.should == expected.strip
|
90
|
+
end
|
45
91
|
end
|
92
|
+
|
93
|
+
|
46
94
|
end
|
47
95
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'webrick'
|
2
|
+
require 'logger'
|
3
|
+
require 'singleton'
|
4
|
+
|
5
|
+
class WebMockServer
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
attr_reader :port
|
9
|
+
|
10
|
+
def host_with_port
|
11
|
+
"localhost:#{port}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def concurrent
|
15
|
+
unless RUBY_PLATFORM =~ /java/
|
16
|
+
@pid = Process.fork do
|
17
|
+
yield
|
18
|
+
end
|
19
|
+
else
|
20
|
+
Thread.new { yield }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def start
|
25
|
+
server = WEBrick::GenericServer.new(:Port => 0, :Logger => Logger.new("/dev/null"))
|
26
|
+
server.logger.level = 0
|
27
|
+
@port = server.config[:Port]
|
28
|
+
|
29
|
+
concurrent do
|
30
|
+
['TERM', 'INT'].each do |signal|
|
31
|
+
trap(signal){ server.shutdown }
|
32
|
+
end
|
33
|
+
server.start do |socket|
|
34
|
+
socket.puts <<-EOT.gsub(/^\s+\|/, '')
|
35
|
+
|HTTP/1.1 200 OK
|
36
|
+
|Date: Fri, 31 Dec 1999 23:59:59 GMT
|
37
|
+
|Content-Type: text/html
|
38
|
+
|Content-Length: 11
|
39
|
+
|
|
40
|
+
|hello world
|
41
|
+
EOT
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
loop do
|
47
|
+
begin
|
48
|
+
s = TCPSocket.new("localhost", port)
|
49
|
+
sleep 0.1
|
50
|
+
break
|
51
|
+
rescue Errno::ECONNREFUSED
|
52
|
+
sleep 0.1
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def stop
|
58
|
+
if @pid
|
59
|
+
Process.kill('INT', @pid)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'webmock_shared'
|
3
|
+
|
4
|
+
unless RUBY_PLATFORM =~ /java/
|
5
|
+
require 'typhoeus_hydra_spec_helper'
|
6
|
+
|
7
|
+
describe "Webmock with Typhoeus::Hydra" do
|
8
|
+
include TyphoeusHydraSpecHelper
|
9
|
+
|
10
|
+
it_should_behave_like "WebMock"
|
11
|
+
|
12
|
+
describe "Typhoeus::Hydra features" do
|
13
|
+
before(:each) do
|
14
|
+
WebMock.disable_net_connect!
|
15
|
+
WebMock.reset!
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "callbacks" do
|
19
|
+
before(:each) do
|
20
|
+
@hydra = Typhoeus::Hydra.new
|
21
|
+
@request = Typhoeus::Request.new("http://example.com")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should call on_complete with 2xx response" do
|
25
|
+
body = "on_success fired"
|
26
|
+
stub_request(:any, "example.com").to_return(:body => body)
|
27
|
+
|
28
|
+
test = nil
|
29
|
+
@hydra.on_complete do |c|
|
30
|
+
test = c.body
|
31
|
+
end
|
32
|
+
@hydra.queue @request
|
33
|
+
@hydra.run
|
34
|
+
test.should == body
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should call on_complete with 5xx response" do
|
38
|
+
response_code = 599
|
39
|
+
stub_request(:any, "example.com").to_return(:status => [response_code, "Server On Fire"])
|
40
|
+
|
41
|
+
test = nil
|
42
|
+
@hydra.on_complete do |c|
|
43
|
+
test = c.code
|
44
|
+
end
|
45
|
+
@hydra.queue @request
|
46
|
+
@hydra.run
|
47
|
+
test.should == response_code
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
module TyphoeusHydraSpecHelper
|
4
|
+
class FakeTyphoeusHydraError < StandardError; end
|
5
|
+
|
6
|
+
|
7
|
+
def http_request(method, uri, options = {}, &block)
|
8
|
+
uri.gsub!(" ", "%20") #typhoeus doesn't like spaces in the uri
|
9
|
+
response = Typhoeus::Request.run(uri,
|
10
|
+
{
|
11
|
+
:method => method,
|
12
|
+
:body => options[:body],
|
13
|
+
:headers => options[:headers],
|
14
|
+
:timeout => 15000 # milliseconds
|
15
|
+
}
|
16
|
+
)
|
17
|
+
raise FakeTyphoeusHydraError.new if response.code.to_s == "0"
|
18
|
+
OpenStruct.new({
|
19
|
+
:body => response.body,
|
20
|
+
:headers => WebMock::Util::Headers.normalize_headers(join_array_values(response.headers_hash)),
|
21
|
+
:status => response.code.to_s,
|
22
|
+
:message => response.status_message
|
23
|
+
})
|
24
|
+
end
|
25
|
+
|
26
|
+
def join_array_values(hash)
|
27
|
+
joined = {}
|
28
|
+
if hash
|
29
|
+
hash.each do |k,v|
|
30
|
+
v = v.join(", ") if v.is_a?(Array)
|
31
|
+
joined[k] = v
|
32
|
+
end
|
33
|
+
end
|
34
|
+
joined
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def client_timeout_exception_class
|
39
|
+
FakeTyphoeusHydraError
|
40
|
+
end
|
41
|
+
|
42
|
+
def connection_refused_exception_class
|
43
|
+
FakeTyphoeusHydraError
|
44
|
+
end
|
45
|
+
|
46
|
+
def http_library
|
47
|
+
:typhoeus
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/spec/util/headers_spec.rb
CHANGED
@@ -9,20 +9,20 @@ describe WebMock::Util::Headers do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "sorted_headers_string" do
|
12
|
-
|
12
|
+
|
13
13
|
it "should return nice string for hash with string values" do
|
14
14
|
WebMock::Util::Headers.sorted_headers_string({"a" => "b"}).should == "{'A'=>'b'}"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "should return nice string for hash with array values" do
|
18
18
|
WebMock::Util::Headers.sorted_headers_string({"a" => ["b", "c"]}).should == "{'A'=>['b', 'c']}"
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should return nice string for hash with array values and string values" do
|
22
22
|
WebMock::Util::Headers.sorted_headers_string({"a" => ["b", "c"], "d" => "e"}).should == "{'A'=>['b', 'c'], 'D'=>'e'}"
|
23
23
|
end
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
|
26
26
|
end
|
27
27
|
|
28
28
|
end
|