Skip to content

Commit

Permalink
fix deprecation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
montague committed Aug 15, 2013
1 parent be0df72 commit 088ed6a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end

group :test do
gem 'rack'
gem 'minitest_tu_shim'
gem 'minitest_tu_shim', :git => "https://github.com/seattlerb/minitest_tu_shim.git"
end

platforms :jruby do
Expand Down
22 changes: 11 additions & 11 deletions spec/unit/errors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
describe WebMock::NetConnectNotAllowedError do
describe "message" do
it "should have message with request signature and snippet" do
request_signature = mock(:to_s => "aaa")
request_stub = mock
WebMock::RequestStub.stub!(:from_request_signature).and_return(request_stub)
WebMock::StubRequestSnippet.stub!(:new).
with(request_stub).and_return(mock(:to_s => "bbb"))
request_signature = double(:to_s => "aaa")
request_stub = double
WebMock::RequestStub.stub(:from_request_signature).and_return(request_stub)
WebMock::StubRequestSnippet.stub(:new).
with(request_stub).and_return(double(:to_s => "bbb"))
expected = "Real HTTP connections are disabled. Unregistered request: aaa" +
"\n\nYou can stub this request with the following snippet:\n\n" +
"bbb\n\n============================================================"
WebMock::NetConnectNotAllowedError.new(request_signature).message.should == expected
end

it "should have message with registered stubs if available" do
request_signature = mock(:to_s => "aaa")
request_stub = mock
WebMock::StubRegistry.instance.stub!(:request_stubs).and_return([request_stub])
WebMock::RequestStub.stub!(:from_request_signature).and_return(request_stub)
WebMock::StubRequestSnippet.stub!(:new).
with(request_stub).and_return(mock(:to_s => "bbb"))
request_signature = double(:to_s => "aaa")
request_stub = double
WebMock::StubRegistry.instance.stub(:request_stubs).and_return([request_stub])
WebMock::RequestStub.stub(:from_request_signature).and_return(request_stub)
WebMock::StubRequestSnippet.stub(:new).
with(request_stub).and_return(double(:to_s => "bbb"))
expected = "Real HTTP connections are disabled. Unregistered request: aaa" +
"\n\nYou can stub this request with the following snippet:\n\n" +
"bbb\n\nregistered request stubs:\n\nbbb\n\n============================================================"
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/request_execution_verifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe WebMock::RequestExecutionVerifier do
before(:each) do
@verifier = WebMock::RequestExecutionVerifier.new
@request_pattern = mock(WebMock::RequestPattern, :to_s => "www.example.com")
@request_pattern = double(WebMock::RequestPattern, :to_s => "www.example.com")
@verifier.request_pattern = @request_pattern
WebMock::RequestRegistry.instance.stub(:to_s).and_return("executed requests")
@executed_requests_info = "\n\nThe following requests were made:\n\nexecuted requests\n" + "="*60
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

it "should create response with options passed as arguments" do
options = {:body => "abc", :headers => {:a => :b}}
WebMock::Response.should_receive(:new).with(options).and_return(@response = mock(WebMock::Response))
WebMock::Response.should_receive(:new).with(options).and_return(@response = double(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"})
WebMock::DynamicResponse.should_receive(:new).with(callable).and_return(@response = mock(WebMock::Response))
callable = double(:call => {:body => "abc"})
WebMock::DynamicResponse.should_receive(:new).with(callable).and_return(@response = double(WebMock::Response))
WebMock::ResponseFactory.response_for(callable).should == @response
end

Expand Down
4 changes: 2 additions & 2 deletions test/shared_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def setup
end

def test_assert_requested_with_stub_and_block_raises_error
assert_raise ArgumentError do
assert_raises ArgumentError do
assert_requested(@stub_http) {}
end
end

def test_assert_not_requested_with_stub_and_block_raises_error
assert_raise ArgumentError do
assert_raises ArgumentError do
assert_not_requested(@stub_http) {}
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class Test::Unit::TestCase
AssertionFailedError = Test::Unit::AssertionFailedError rescue MiniTest::Assertion
def assert_raise_with_message(e, message, &block)
e = assert_raise(e, &block)
e = assert_raises(e, &block)
if message.is_a?(Regexp)
assert_match(message, e.message)
else
Expand Down

0 comments on commit 088ed6a

Please sign in to comment.