Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added explicit WebMock scope to all constants in WebMock specs and re…

…moved global include WebMock in spec_helper.
  • Loading branch information...
commit 4cdf18c91c1ee0d028a0a32b22c994324c3e5c02 1 parent 7d2f07a
@bblimke authored
View
2  spec/curb_spec.rb
@@ -21,7 +21,7 @@
describe "Curb features" do
before(:each) do
WebMock.disable_net_connect!
- RequestRegistry.instance.reset_webmock
+ WebMock::RequestRegistry.instance.reset_webmock
end
describe "callbacks" do
View
18 spec/request_execution_verifier_spec.rb
@@ -1,9 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe RequestExecutionVerifier do
+describe WebMock::RequestExecutionVerifier do
before(:each) do
- @verifier = RequestExecutionVerifier.new
- @request_pattern = mock(RequestPattern, :to_s => "www.example.com")
+ @verifier = WebMock::RequestExecutionVerifier.new
+ @request_pattern = mock(WebMock::RequestPattern, :to_s => "www.example.com")
@verifier.request_pattern = @request_pattern
end
@@ -42,14 +42,14 @@
describe "matches?" do
it "should succeed if request was executed expected number of times" do
- RequestRegistry.instance.
+ WebMock::RequestRegistry.instance.
should_receive(:times_executed).with(@request_pattern).and_return(10)
@verifier.expected_times_executed = 10
@verifier.matches?.should be_true
end
it "should fail if request was not executed expected number of times" do
- RequestRegistry.instance.
+ WebMock::RequestRegistry.instance.
should_receive(:times_executed).with(@request_pattern).and_return(10)
@verifier.expected_times_executed = 5
@verifier.matches?.should be_false
@@ -60,26 +60,26 @@
describe "does_not_match?" do
it "should fail if request executed expected number of times" do
- RequestRegistry.instance.
+ WebMock::RequestRegistry.instance.
should_receive(:times_executed).with(@request_pattern).and_return(10)
@verifier.expected_times_executed = 10
@verifier.does_not_match?.should be_false
end
it "should succeed if request was not executed at all and expected number of times was not set" do
- RequestRegistry.instance.
+ WebMock::RequestRegistry.instance.
should_receive(:times_executed).with(@request_pattern).and_return(0)
@verifier.does_not_match?.should be_true
end
it "should fail if request was executed and expected number of times was not set" do
- RequestRegistry.instance.
+ WebMock::RequestRegistry.instance.
should_receive(:times_executed).with(@request_pattern).and_return(1)
@verifier.does_not_match?.should be_false
end
it "should succeed if request was not executed expected number of times" do
- RequestRegistry.instance.
+ WebMock::RequestRegistry.instance.
should_receive(:times_executed).with(@request_pattern).and_return(10)
@verifier.expected_times_executed = 5
@verifier.does_not_match?.should be_true
View
230 spec/request_pattern_spec.rb
@@ -1,37 +1,37 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe RequestPattern do
+describe WebMock::RequestPattern do
it "should report string describing itself" do
- RequestPattern.new(:get, "www.example.com",
+ WebMock::RequestPattern.new(:get, "www.example.com",
:body => "abc", :headers => {'A' => 'a', 'B' => 'b'}).to_s.should ==
"GET http://www.example.com/ with body \"abc\" with headers {'A'=>'a', 'B'=>'b'}"
end
it "should report string describing itself with block" do
- RequestPattern.new(:get, "www.example.com",
+ WebMock::RequestPattern.new(:get, "www.example.com",
:body => "abc", :headers => {'A' => 'a', 'B' => 'b'}).with {|req| true}.to_s.should ==
"GET http://www.example.com/ with body \"abc\" with headers {'A'=>'a', 'B'=>'b'} with given block"
end
it "should report string describing itself with query params" do
- RequestPattern.new(:get, /.*example.*/, :query => {'a' => ['b', 'c']}).to_s.should ==
+ WebMock::RequestPattern.new(:get, /.*example.*/, :query => {'a' => ['b', 'c']}).to_s.should ==
"GET /.*example.*/ with query params {\"a\"=>[\"b\", \"c\"]}"
end
describe "with" do
before(:each) do
- @request_pattern = RequestPattern.new(:get, "www.example.com")
+ @request_pattern =WebMock::RequestPattern.new(:get, "www.example.com")
end
it "should have assigned body pattern" do
@request_pattern.with(:body => "abc")
- @request_pattern.to_s.should == RequestPattern.new(:get, "www.example.com", :body => "abc").to_s
+ @request_pattern.to_s.should ==WebMock::RequestPattern.new(:get, "www.example.com", :body => "abc").to_s
end
it "should have assigned normalized headers pattern" do
@request_pattern.with(:headers => {'A' => 'a'})
- @request_pattern.to_s.should == RequestPattern.new(:get, "www.example.com", :headers => {'A' => 'a'}).to_s
+ @request_pattern.to_s.should ==WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A' => 'a'}).to_s
end
end
@@ -46,80 +46,80 @@ def match(request_signature)
describe "when matching" do
it "should match if uri matches and method matches" do
- RequestPattern.new(:get, "www.example.com").
- should match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:get, "www.example.com").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
it "should match if uri matches and method pattern is any" do
- RequestPattern.new(:any, "www.example.com").
- should match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:any, "www.example.com").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
it "should not match if request has different method" do
- RequestPattern.new(:post, "www.example.com").
- should_not match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:post, "www.example.com").
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
it "should match if uri matches request uri" do
- RequestPattern.new(:get, "www.example.com").
- should match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:get, "www.example.com").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
it "should match if request has unescaped uri" do
- RequestPattern.new(:get, "www.example.com/my%20path").
- should match(RequestSignature.new(:get, "www.example.com/my path"))
+ WebMock::RequestPattern.new(:get, "www.example.com/my%20path").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/my path"))
end
it "should match if request has escaped uri" do
- RequestPattern.new(:get, "www.example.com/my path").
- should match(RequestSignature.new(:get, "www.example.com/my%20path"))
+ WebMock::RequestPattern.new(:get, "www.example.com/my path").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/my%20path"))
end
it "should match if uri regexp pattern matches unescaped form of request uri" do
- RequestPattern.new(:get, /.*my path.*/).
- should match(RequestSignature.new(:get, "www.example.com/my%20path"))
+ WebMock::RequestPattern.new(:get, /.*my path.*/).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/my%20path"))
end
it "should match if uri regexp pattern matches request uri" do
- RequestPattern.new(:get, /.*example.*/).
- should match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:get, /.*example.*/).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
it "should match for uris with same parameters as pattern" do
- RequestPattern.new(:get, "www.example.com?a=1&b=2").
- should match(RequestSignature.new(:get, "www.example.com?a=1&b=2"))
+ WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
end
it "should not match for uris with different parameters" do
- RequestPattern.new(:get, "www.example.com?a=1&b=2").
- should_not match(RequestSignature.new(:get, "www.example.com?a=2&b=1"))
+ WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2").
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?a=2&b=1"))
end
it "should match for uri parameters in different order" do
- RequestPattern.new(:get, "www.example.com?b=2&a=1").
- should match(RequestSignature.new(:get, "www.example.com?a=1&b=2"))
+ WebMock::RequestPattern.new(:get, "www.example.com?b=2&a=1").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
end
describe "when parameters are escaped" do
it "should match if uri pattern has escaped parameters and request has unescaped parameters" do
- RequestPattern.new(:get, "www.example.com/?a=a%20b").
- should match(RequestSignature.new(:get, "www.example.com/?a=a b"))
+ WebMock::RequestPattern.new(:get, "www.example.com/?a=a%20b").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a b"))
end
it "should match if uri pattern has unescaped parameters and request has escaped parameters" do
- RequestPattern.new(:get, "www.example.com/?a=a b").
- should match(RequestSignature.new(:get, "www.example.com/?a=a%20b"))
+ WebMock::RequestPattern.new(:get, "www.example.com/?a=a b").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a%20b"))
end
it "should match if uri regexp pattern matches uri with unescaped parameters and request has escaped parameters" do
- RequestPattern.new(:get, /.*a=a b.*/).
- should match(RequestSignature.new(:get, "www.example.com/?a=a%20b"))
+ WebMock::RequestPattern.new(:get, /.*a=a b.*/).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a%20b"))
end
it "should match if uri regexp pattern matches uri with escaped parameters and request has unescaped parameters" do
- RequestPattern.new(:get, /.*a=a%20b.*/).
- should match(RequestSignature.new(:get, "www.example.com/?a=a b"))
+ WebMock::RequestPattern.new(:get, /.*a=a%20b.*/).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a b"))
end
end
@@ -127,33 +127,33 @@ def match(request_signature)
describe "when matching requests on query params" do
it "should match request query params even if uri is declared as regexp" do
- RequestPattern.new(:get, /.*example.*/, :query => {"a" => ["b", "c"]}).
- should match(RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
+ WebMock::RequestPattern.new(:get, /.*example.*/, :query => {"a" => ["b", "c"]}).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
end
it "should match request query params if uri is declared as regexp but params don't match" do
- RequestPattern.new(:get, /.*example.*/, :query => {"x" => ["b", "c"]}).
- should_not match(RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
+ WebMock::RequestPattern.new(:get, /.*example.*/, :query => {"x" => ["b", "c"]}).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
end
it "should match for query params are the same as declared in hash" do
- RequestPattern.new(:get, "www.example.com", :query => {"a" => ["b", "c"]}).
- should match(RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :query => {"a" => ["b", "c"]}).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
end
it "should not match for query params are different than the declared in hash" do
- RequestPattern.new(:get, "www.example.com", :query => {"a" => ["b", "c"]}).
- should_not match(RequestSignature.new(:get, "www.example.com?x[]=b&a[]=c"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :query => {"a" => ["b", "c"]}).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?x[]=b&a[]=c"))
end
it "should match for query params are the same as declared as string" do
- RequestPattern.new(:get, "www.example.com", :query => "a[]=b&a[]=c").
- should match(RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :query => "a[]=b&a[]=c").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
end
it "should match for query params are the same as declared both in query option or url" do
- RequestPattern.new(:get, "www.example.com/?x=3", :query => "a[]=b&a[]=c").
- should match(RequestSignature.new(:get, "www.example.com/?x=3&a[]=b&a[]=c"))
+ WebMock::RequestPattern.new(:get, "www.example.com/?x=3", :query => "a[]=b&a[]=c").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?x=3&a[]=b&a[]=c"))
end
end
@@ -161,43 +161,43 @@ def match(request_signature)
describe "when matching requests with body" do
it "should match if request body and body pattern are the same" do
- RequestPattern.new(:get, "www.example.com", :body => "abc").
- should match(RequestSignature.new(:get, "www.example.com", :body => "abc"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => "abc").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
end
it "should match if request body matches regexp" do
- RequestPattern.new(:get, "www.example.com", :body => /^abc$/).
- should match(RequestSignature.new(:get, "www.example.com", :body => "abc"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => /^abc$/).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
end
it "should not match if body pattern is different than request body" do
- RequestPattern.new(:get, "www.example.com", :body => "def").
- should_not match(RequestSignature.new(:get, "www.example.com", :body => "abc"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => "def").
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
end
it "should not match if request body doesn't match regexp pattern" do
- RequestPattern.new(:get, "www.example.com", :body => /^abc$/).
- should_not match(RequestSignature.new(:get, "www.example.com", :body => "xabc"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => /^abc$/).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "xabc"))
end
it "should match if pattern doesn't have specified body" do
- RequestPattern.new(:get, "www.example.com").
- should match(RequestSignature.new(:get, "www.example.com", :body => "abc"))
+ WebMock::RequestPattern.new(:get, "www.example.com").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
end
it "should not match if pattern has body specified as nil but request body is not empty" do
- RequestPattern.new(:get, "www.example.com", :body => nil).
- should_not match(RequestSignature.new(:get, "www.example.com", :body => "abc"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => nil).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
end
it "should not match if pattern has empty body but request body is not empty" do
- RequestPattern.new(:get, "www.example.com", :body => "").
- should_not match(RequestSignature.new(:get, "www.example.com", :body => "abc"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => "").
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
end
it "should not match if pattern has body specified but request has no body" do
- RequestPattern.new(:get, "www.example.com", :body => "abc").
- should_not match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => "abc").
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
describe "when body in pattern is declared as a hash" do
@@ -205,43 +205,43 @@ def match(request_signature)
describe "for request with url encoded body" do
it "should match when hash matches body" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should match(RequestSignature.new(:post, "www.example.com", :body => 'a=1&c[d][]=e&c[d][]=f&b=five'))
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=1&c[d][]=e&c[d][]=f&b=five'))
end
it "should match when hash matches body in different order of params" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should match(RequestSignature.new(:post, "www.example.com", :body => 'a=1&c[d][]=e&b=five&c[d][]=f'))
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=1&c[d][]=e&b=five&c[d][]=f'))
end
it "should not match when hash doesn't match url encoded body" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should_not match(RequestSignature.new(:post, "www.example.com", :body => 'c[d][]=f&a=1&c[d][]=e'))
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'c[d][]=f&a=1&c[d][]=e'))
end
it "should not match when body is not url encoded" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should_not match(RequestSignature.new(:post, "www.example.com", :body => 'foo bar'))
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'foo bar'))
end
end
describe "for request with json body and content type is set to json" do
it "should match when hash matches body" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should match(RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/json'},
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/json'},
:body => "{\"a\":\"1\",\"c\":{\"d\":[\"e\",\"f\"]},\"b\":\"five\"}"))
end
it "should match if hash matches body in different form" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should match(RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/json'},
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/json'},
:body => "{\"a\":\"1\",\"b\":\"five\",\"c\":{\"d\":[\"e\",\"f\"]}}"))
end
it "should not match when body is not json" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should_not match(RequestSignature.new(:post, "www.example.com",
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com",
:headers => {:content_type => 'application/json'}, :body => "foo bar"))
end
end
@@ -250,20 +250,20 @@ def match(request_signature)
let(:body_hash) { {"opt" => {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']}}} }
it "should match when hash matches body" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should match(RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/xml'},
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/xml'},
:body => "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
end
it "should match if hash matches body in different form" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should match(RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/xml'},
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/xml'},
:body => "<opt b=\"five\" a=\"1\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
end
it "should not match when body is not xml" do
- RequestPattern.new(:post, 'www.example.com', :body => body_hash).
- should_not match(RequestSignature.new(:post, "www.example.com",
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com",
:headers => {:content_type => 'application/xml'}, :body => "foo bar"))
end
end
@@ -273,78 +273,78 @@ def match(request_signature)
it "should match if pattern and request have the same headers" do
- RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}).
- should match(RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
end
it "should match if pattern headers values are regexps matching request header values" do
- RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => %r{^image/jpeg$}}).
- should match(RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => %r{^image/jpeg$}}).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
end
it "should not match if pattern has different value of header than request" do
- RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/png'}).
- should_not match(RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/png'}).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
end
it "should not match if pattern header value regexp doesn't match request header value" do
- RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => %r{^image\/jpeg$}}).
- should_not match(RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpegx'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => %r{^image\/jpeg$}}).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpegx'}))
end
it "should match if request has more headers than request pattern" do
- RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}).
- should match(RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg', 'Content-Length' => '8888'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg', 'Content-Length' => '8888'}))
end
it "should not match if request has less headers than the request pattern" do
- RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg', 'Content-Length' => '8888'}).
- should_not match(RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg', 'Content-Length' => '8888'}).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
end
it "should match even is header keys are declared in different form" do
- RequestPattern.new(:get, "www.example.com", :headers => {'ContentLength' => '8888', 'Content-type' => 'image/png'}).
- should match(RequestSignature.new(:get, "www.example.com", :headers => {:ContentLength => 8888, 'content_type' => 'image/png'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'ContentLength' => '8888', 'Content-type' => 'image/png'}).
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {:ContentLength => 8888, 'content_type' => 'image/png'}))
end
it "should match is pattern doesn't have specified headers" do
- RequestPattern.new(:get, "www.example.com").
- should match(RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
+ WebMock::RequestPattern.new(:get, "www.example.com").
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
end
it "should not match if pattern has nil headers but request has headers" do
- RequestPattern.new(:get, "www.example.com", :headers => nil).
- should_not match(RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => nil).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
end
it "should not match if pattern has empty headers but request has headers" do
- RequestPattern.new(:get, "www.example.com", :headers => {}).
- should_not match(RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {}).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
end
it "should not match if pattern has specified headers but request has nil headers" do
- RequestPattern.new(:get, "www.example.com", :headers => {'A'=>'a'}).
- should_not match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A'=>'a'}).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
it "should not match if pattern has specified headers but request has empty headers" do
- RequestPattern.new(:get, "www.example.com", :headers => {'A'=>'a'}).
- should_not match(RequestSignature.new(:get, "www.example.com", :headers => {}))
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A'=>'a'}).
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {}))
end
it "should match if block given in pattern evaluates request to true" do
- RequestPattern.new(:get, "www.example.com").with { |request| true }.
- should match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:get, "www.example.com").with { |request| true }.
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
it "should not match if block given in pattrn evaluates request to false" do
- RequestPattern.new(:get, "www.example.com").with { |request| false }.
- should_not match(RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestPattern.new(:get, "www.example.com").with { |request| false }.
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com"))
end
it "should yield block with request signature" do
- signature = RequestSignature.new(:get, "www.example.com")
- RequestPattern.new(:get, "www.example.com").with { |request| request == signature }.
+ signature = WebMock::RequestSignature.new(:get, "www.example.com")
+ WebMock::RequestPattern.new(:get, "www.example.com").with { |request| request == signature }.
should match(signature)
end
View
86 spec/request_registry_spec.rb
@@ -1,30 +1,30 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe RequestRegistry do
+describe WebMock::RequestRegistry do
before(:each) do
- RequestRegistry.instance.reset_webmock
- @request_pattern = RequestPattern.new(:get, "www.example.com")
- @request_signature = RequestSignature.new(:get, "www.example.com")
- @request_stub = RequestStub.new(:get, "www.example.com")
+ WebMock::RequestRegistry.instance.reset_webmock
+ @request_pattern = WebMock::RequestPattern.new(:get, "www.example.com")
+ @request_signature = WebMock::RequestSignature.new(:get, "www.example.com")
+ @request_stub = WebMock::RequestStub.new(:get, "www.example.com")
end
describe "reset_webmock" do
before(:each) do
- RequestRegistry.instance.register_request_stub(@request_stub)
- RequestRegistry.instance.requested_signatures.put(@request_signature)
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub)
+ WebMock::RequestRegistry.instance.requested_signatures.put(@request_signature)
end
it "should clean request stubs" do
- RequestRegistry.instance.registered_request?(@request_signature).should == @request_stub
- RequestRegistry.instance.reset_webmock
- RequestRegistry.instance.registered_request?(@request_signature).should == nil
+ WebMock::RequestRegistry.instance.registered_request?(@request_signature).should == @request_stub
+ WebMock::RequestRegistry.instance.reset_webmock
+ WebMock::RequestRegistry.instance.registered_request?(@request_signature).should == nil
end
it "should clean list of executed requests" do
- RequestRegistry.instance.times_executed(@request_pattern).should == 1
- RequestRegistry.instance.reset_webmock
- RequestRegistry.instance.times_executed(@request_pattern).should == 0
+ WebMock::RequestRegistry.instance.times_executed(@request_pattern).should == 1
+ WebMock::RequestRegistry.instance.reset_webmock
+ WebMock::RequestRegistry.instance.times_executed(@request_pattern).should == 0
end
end
@@ -32,16 +32,16 @@
describe "registering and reporting registered requests" do
it "should return registered stub" do
- RequestRegistry.instance.register_request_stub(@request_stub).should == @request_stub
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub).should == @request_stub
end
it "should report if request stub is not registered" do
- RequestRegistry.instance.registered_request?(@request_signature).should == nil
+ WebMock::RequestRegistry.instance.registered_request?(@request_signature).should == nil
end
it "should register and report registered stib" do
- RequestRegistry.instance.register_request_stub(@request_stub)
- RequestRegistry.instance.registered_request?(@request_signature).should == @request_stub
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub)
+ WebMock::RequestRegistry.instance.registered_request?(@request_signature).should == @request_stub
end
@@ -51,40 +51,42 @@
it "should report registered evaluated response for request pattern" do
@request_stub.to_return(:body => "abc")
- RequestRegistry.instance.register_request_stub(@request_stub)
- RequestRegistry.instance.response_for_request(@request_signature).should == Response.new(:body => "abc")
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub)
+ WebMock::RequestRegistry.instance.response_for_request(@request_signature).
+ should == WebMock::Response.new(:body => "abc")
end
it "should report evaluated response" do
@request_stub.to_return {|request| {:body => request.method.to_s} }
- RequestRegistry.instance.register_request_stub(@request_stub)
- response1 = RequestRegistry.instance.response_for_request(@request_signature)
- response1.should == Response.new(:body => "get")
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub)
+ response1 = WebMock::RequestRegistry.instance.response_for_request(@request_signature)
+ response1.should == WebMock::Response.new(:body => "get")
end
it "should report clone of theresponse" do
@request_stub.to_return {|request| {:body => request.method.to_s} }
- RequestRegistry.instance.register_request_stub(@request_stub)
- response1 = RequestRegistry.instance.response_for_request(@request_signature)
- response2 = RequestRegistry.instance.response_for_request(@request_signature)
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub)
+ response1 = WebMock::RequestRegistry.instance.response_for_request(@request_signature)
+ response2 = WebMock::RequestRegistry.instance.response_for_request(@request_signature)
response1.should_not be(response2)
end
it "should report nothing if no response for request is registered" do
- RequestRegistry.instance.response_for_request(@request_signature).should == nil
+ WebMock::RequestRegistry.instance.response_for_request(@request_signature).should == nil
end
it "should always return last registered matching response" do
- @request_stub1 = RequestStub.new(:get, "www.example.com")
+ @request_stub1 = WebMock::RequestStub.new(:get, "www.example.com")
@request_stub1.to_return(:body => "abc")
- @request_stub2 = RequestStub.new(:get, "www.example.com")
+ @request_stub2 = WebMock::RequestStub.new(:get, "www.example.com")
@request_stub2.to_return(:body => "def")
- @request_stub3 = RequestStub.new(:get, "www.example.org")
+ @request_stub3 = WebMock::RequestStub.new(:get, "www.example.org")
@request_stub3.to_return(:body => "ghj")
- RequestRegistry.instance.register_request_stub(@request_stub1)
- RequestRegistry.instance.register_request_stub(@request_stub2)
- RequestRegistry.instance.register_request_stub(@request_stub3)
- RequestRegistry.instance.response_for_request(@request_signature).should == Response.new(:body => "def")
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub1)
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub2)
+ WebMock::RequestRegistry.instance.register_request_stub(@request_stub3)
+ WebMock::RequestRegistry.instance.response_for_request(@request_signature).
+ should == WebMock::Response.new(:body => "def")
end
end
@@ -98,24 +100,24 @@ def times_executed(request_pattern)
end
before(:each) do
- @request_stub1 = RequestStub.new(:get, "www.example.com")
- @request_stub2 = RequestStub.new(:get, "www.example.net")
- @request_stub3 = RequestStub.new(:get, "www.example.org")
- RequestRegistry.instance.requested_signatures.put(RequestSignature.new(:get, "www.example.com"))
- RequestRegistry.instance.requested_signatures.put(RequestSignature.new(:get, "www.example.com"))
- RequestRegistry.instance.requested_signatures.put(RequestSignature.new(:get, "www.example.org"))
+ @request_stub1 = WebMock::RequestStub.new(:get, "www.example.com")
+ @request_stub2 = WebMock::RequestStub.new(:get, "www.example.net")
+ @request_stub3 = WebMock::RequestStub.new(:get, "www.example.org")
+ WebMock::RequestRegistry.instance.requested_signatures.put(WebMock::RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestRegistry.instance.requested_signatures.put(WebMock::RequestSignature.new(:get, "www.example.com"))
+ WebMock::RequestRegistry.instance.requested_signatures.put(WebMock::RequestSignature.new(:get, "www.example.org"))
end
it "should report 0 if no request matching pattern was requested" do
- RequestRegistry.instance.times_executed(RequestPattern.new(:get, "www.example.net")).should == 0
+ WebMock::RequestRegistry.instance.times_executed(WebMock::RequestPattern.new(:get, "www.example.net")).should == 0
end
it "should report number of times matching pattern was requested" do
- RequestRegistry.instance.times_executed(RequestPattern.new(:get, "www.example.com")).should == 2
+ WebMock::RequestRegistry.instance.times_executed(WebMock::RequestPattern.new(:get, "www.example.com")).should == 2
end
it "should report number of times all matching pattern were requested" do
- RequestRegistry.instance.times_executed(RequestPattern.new(:get, /.*example.*/)).should == 3
+ WebMock::RequestRegistry.instance.times_executed(WebMock::RequestPattern.new(:get, /.*example.*/)).should == 3
end
View
12 spec/request_signature_spec.rb
@@ -1,35 +1,35 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe RequestSignature do
+describe WebMock::RequestSignature do
describe "initialization" do
it "should have assigned normalized uri" do
WebMock::Util::URI.should_receive(:normalize_uri).and_return("www.example.kom")
- signature = RequestSignature.new(:get, "www.example.com")
+ signature = WebMock::RequestSignature.new(:get, "www.example.com")
signature.uri.should == "www.example.kom"
end
it "should have assigned uri without normalization if uri is URI" do
WebMock::Util::URI.should_not_receive(:normalize_uri)
uri = Addressable::URI.parse("www.example.com")
- signature = RequestSignature.new(:get, uri)
+ signature = WebMock::RequestSignature.new(:get, uri)
signature.uri.should == uri
end
it "should have assigned normalized headers" do
WebMock::Util::Headers.should_receive(:normalize_headers).with('A' => 'a').and_return('B' => 'b')
- RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}).headers.should == {'B' => 'b'}
+ WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}).headers.should == {'B' => 'b'}
end
it "should have assigned body" do
- RequestSignature.new(:get, "www.example.com", :body => "abc").body.should == "abc"
+ WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc").body.should == "abc"
end
end
it "should report string describing itself" do
- RequestSignature.new(:get, "www.example.com",
+ WebMock::RequestSignature.new(:get, "www.example.com",
:body => "abc", :headers => {'A' => 'a', 'B' => 'b'}).to_s.should ==
"GET http://www.example.com/ with body 'abc' with headers {'A'=>'a', 'B'=>'b'}"
end
View
10 spec/request_stub_spec.rb
@@ -1,9 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe RequestStub do
+describe WebMock::RequestStub do
before(:each) do
- @request_stub = RequestStub.new(:get, "www.example.com")
+ @request_stub = WebMock::RequestStub.new(:get, "www.example.com")
end
it "should have request pattern with method and uri" do
@@ -18,18 +18,18 @@
it "should assign body to request pattern" do
@request_stub.with(:body => "abc")
- @request_stub.request_pattern.to_s.should == RequestPattern.new(:get, "www.example.com", :body => "abc").to_s
+ @request_stub.request_pattern.to_s.should == WebMock::RequestPattern.new(:get, "www.example.com", :body => "abc").to_s
end
it "should assign normalized headers to request pattern" do
@request_stub.with(:headers => {'A' => 'a'})
@request_stub.request_pattern.to_s.should ==
- RequestPattern.new(:get, "www.example.com", :headers => {'A' => 'a'}).to_s
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A' => 'a'}).to_s
end
it "should assign given block to request profile" do
@request_stub.with { |req| req.body == "abc" }
- @request_stub.request_pattern.matches?(RequestSignature.new(:get, "www.example.com", :body => "abc")).should be_true
+ @request_stub.request_pattern.matches?(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc")).should be_true
end
end
View
66 spec/response_spec.rb
@@ -1,34 +1,34 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe ResponseFactory do
+describe WebMock::ResponseFactory do
describe "response_for" do
it "should create response with options passed as arguments" do
options = {:body => "abc", :headers => {:a => :b}}
- Response.should_receive(:new).with(options).and_return(@response = mock(Response))
- ResponseFactory.response_for(options).should == @response
+ WebMock::Response.should_receive(:new).with(options).and_return(@response = mock(WebMock::Response))
+ WebMock::ResponseFactory.response_for(options).should == @response
end
it "should create dynamic response for argument responding to call" do
callable = mock(:call => {:body => "abc"})
- DynamicResponse.should_receive(:new).with(callable).and_return(@response = mock(Response))
- ResponseFactory.response_for(callable).should == @response
+ WebMock::DynamicResponse.should_receive(:new).with(callable).and_return(@response = mock(WebMock::Response))
+ WebMock::ResponseFactory.response_for(callable).should == @response
end
end
end
-describe Response do
+describe WebMock::Response do
before(:each) do
- @response = Response.new(:headers => {'A' => 'a'})
+ @response = WebMock::Response.new(:headers => {'A' => 'a'})
end
it "should report normalized headers" do
- Util::Headers.should_receive(:normalize_headers).with('A' => 'a').and_return('B' => 'b')
- @response = Response.new(:headers => {'A' => 'a'})
+ WebMock::Util::Headers.should_receive(:normalize_headers).with('A' => 'a').and_return('B' => 'b')
+ @response = WebMock::Response.new(:headers => {'A' => 'a'})
@response.headers.should == {'B' => 'b'}
end
@@ -39,12 +39,12 @@
end
it "should return assigned status" do
- @response = Response.new(:status => 500)
+ @response = WebMock::Response.new(:status => 500)
@response.status.should == [500, ""]
end
it "should return assigned message" do
- @response = Response.new(:status => [500, "Internal Server Error"])
+ @response = WebMock::Response.new(:status => [500, "Internal Server Error"])
@response.status.should == [500, "Internal Server Error"]
end
@@ -53,21 +53,21 @@
describe "raising error" do
it "should raise error if any assigned" do
- @response = Response.new(:exception => ArgumentError)
+ @response = WebMock::Response.new(:exception => ArgumentError)
lambda {
@response.raise_error_if_any
}.should raise_error(ArgumentError, "Exception from WebMock")
end
it "should raise error if any assigned as instance" do
- @response = Response.new(:exception => ArgumentError.new("hello world"))
+ @response = WebMock::Response.new(:exception => ArgumentError.new("hello world"))
lambda {
@response.raise_error_if_any
}.should raise_error(ArgumentError, "hello world")
end
it "should raise error if any assigned as string" do
- @response = Response.new(:exception => "hello world")
+ @response = WebMock::Response.new(:exception => "hello world")
lambda {
@response.raise_error_if_any
}.should raise_error("hello world")
@@ -82,12 +82,12 @@
describe "timeout" do
it "should know if it should timeout" do
- @response = Response.new(:should_timeout => true)
+ @response = WebMock::Response.new(:should_timeout => true)
@response.should_timeout.should be_true
end
it "should not timeout by default" do
- @response = Response.new
+ @response = WebMock::Response.new
@response.should_timeout.should be_false
end
@@ -100,22 +100,22 @@
end
it "should report body if assigned" do
- @response = Response.new(:body => "abc")
+ @response = WebMock::Response.new(:body => "abc")
@response.body.should == "abc"
end
it "should report string even if existing file path was provided" do
- @response = Response.new(:body => __FILE__)
+ @response = WebMock::Response.new(:body => __FILE__)
@response.body.should == __FILE__
end
it "should report content of a IO object if provided" do
- @response = Response.new(:body => File.new(__FILE__))
+ @response = WebMock::Response.new(:body => File.new(__FILE__))
@response.body.should == File.new(__FILE__).read
end
it "should report many times content of a IO object if provided" do
- @response = Response.new(:body => File.new(__FILE__))
+ @response = WebMock::Response.new(:body => File.new(__FILE__))
@response.body.should == File.new(__FILE__).read
@response.body.should == File.new(__FILE__).read
end
@@ -127,7 +127,7 @@
describe "when input is IO" do
before(:each) do
@file = File.new(File.expand_path(File.dirname(__FILE__)) + "/example_curl_output.txt")
- @response = Response.new(@file)
+ @response = WebMock::Response.new(@file)
end
@@ -158,7 +158,7 @@
describe "when input is String" do
before(:each) do
@input = File.new(File.expand_path(File.dirname(__FILE__)) + "/example_curl_output.txt").read
- @response = Response.new(@input)
+ @response = WebMock::Response.new(@input)
end
it "should read status" do
@@ -181,7 +181,7 @@
it "should work with transfer-encoding set to chunked" do
@input.gsub!("Content-Length: 438", "Transfer-Encoding: chunked")
- @response = Response.new(@input)
+ @response = WebMock::Response.new(@input)
@response.body.size.should == 438
end
@@ -190,21 +190,21 @@
describe "with dynamically evaluated options" do
before(:each) do
- @request_signature = RequestSignature.new(:post, "www.example.com", :body => "abc", :headers => {'A' => 'a'})
+ @request_signature = WebMock::RequestSignature.new(:post, "www.example.com", :body => "abc", :headers => {'A' => 'a'})
end
it "should have evaluated body" do
- @response = Response.new(:body => lambda {|request| request.body})
+ @response = WebMock::Response.new(:body => lambda {|request| request.body})
@response.evaluate!(@request_signature).body.should == "abc"
end
it "should have evaluated headers" do
- @response = Response.new(:headers => lambda {|request| request.headers})
+ @response = WebMock::Response.new(:headers => lambda {|request| request.headers})
@response.evaluate!(@request_signature).headers.should == {'A' => 'a'}
end
it "should have evaluated status" do
- @response = Response.new(:status => lambda {|request| 302})
+ @response = WebMock::Response.new(:status => lambda {|request| 302})
@response.evaluate!(@request_signature).status.should == [302, ""]
end
@@ -212,13 +212,13 @@
end
- describe DynamicResponse do
+ describe WebMock::DynamicResponse do
describe "evaluating response options" do
it "should have evaluated options" do
- request_signature = RequestSignature.new(:post, "www.example.com", :body => "abc", :headers => {'A' => 'a'})
- response = DynamicResponse.new(lambda {|request|
+ request_signature = WebMock::RequestSignature.new(:post, "www.example.com", :body => "abc", :headers => {'A' => 'a'})
+ response = WebMock::DynamicResponse.new(lambda {|request|
{
:body => request.body,
:headers => request.headers,
@@ -232,10 +232,10 @@
end
it "should be equal to static response after evaluation" do
- request_signature = RequestSignature.new(:post, "www.example.com", :body => "abc")
- response = DynamicResponse.new(lambda {|request| {:body => request.body}})
+ request_signature = WebMock::RequestSignature.new(:post, "www.example.com", :body => "abc")
+ response = WebMock::DynamicResponse.new(lambda {|request| {:body => request.body}})
response.evaluate!(request_signature)
- response.should == Response.new(:body => "abc")
+ response.should == WebMock::Response.new(:body => "abc")
end
end
View
2  spec/spec_helper.rb
@@ -15,8 +15,6 @@
require 'json'
-include WebMock
-
Spec::Runner.configure do |config|
config.include WebMock
end
View
8 spec/util/hash_counter_spec.rb
@@ -1,13 +1,13 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-describe Util::HashCounter do
+describe WebMock::Util::HashCounter do
it "should return 0 for non existing key" do
- Util::HashCounter.new.get(:abc).should == 0
+ WebMock::Util::HashCounter.new.get(:abc).should == 0
end
it "should increase the returned value on every put with the same key" do
- counter =Util::HashCounter.new
+ counter = WebMock::Util::HashCounter.new
counter.put(:abc)
counter.get(:abc).should == 1
counter.put(:abc)
@@ -15,7 +15,7 @@
end
it "should only increase value for given key provided to put" do
- counter =Util::HashCounter.new
+ counter = WebMock::Util::HashCounter.new
counter.put(:abc)
counter.get(:abc).should == 1
counter.get(:def).should == 0
View
8 spec/util/headers_spec.rb
@@ -4,22 +4,22 @@
it "should decode_userinfo_from_header handles basic auth" do
authorization_header = "Basic dXNlcm5hbWU6c2VjcmV0"
- userinfo = Util::Headers.decode_userinfo_from_header(authorization_header)
+ userinfo = WebMock::Util::Headers.decode_userinfo_from_header(authorization_header)
userinfo.should == "username:secret"
end
describe "sorted_headers_string" do
it "should return nice string for hash with string values" do
- Util::Headers.sorted_headers_string({"a" => "b"}).should == "{'A'=>'b'}"
+ WebMock::Util::Headers.sorted_headers_string({"a" => "b"}).should == "{'A'=>'b'}"
end
it "should return nice string for hash with array values" do
- Util::Headers.sorted_headers_string({"a" => ["b", "c"]}).should == "{'A'=>['b', 'c']}"
+ WebMock::Util::Headers.sorted_headers_string({"a" => ["b", "c"]}).should == "{'A'=>['b', 'c']}"
end
it "should return nice string for hash with array values and string values" do
- Util::Headers.sorted_headers_string({"a" => ["b", "c"], "d" => "e"}).should == "{'A'=>['b', 'c'], 'D'=>'e'}"
+ WebMock::Util::Headers.sorted_headers_string({"a" => ["b", "c"], "d" => "e"}).should == "{'A'=>['b', 'c'], 'D'=>'e'}"
end
View
2  spec/webmock_spec.rb
@@ -21,7 +21,7 @@ class MyException < StandardError; end;
describe "WebMock", :shared => true do
before(:each) do
WebMock.disable_net_connect!
- RequestRegistry.instance.reset_webmock
+ WebMock::RequestRegistry.instance.reset_webmock
end
describe "when web connect" do
Please sign in to comment.
Something went wrong with that request. Please try again.