From 088ed6aff1ce36c62e77f7acd1f61f899707aff9 Mon Sep 17 00:00:00 2001 From: ian asaff Date: Thu, 15 Aug 2013 14:16:20 -0400 Subject: [PATCH] fix deprecation messages --- Gemfile | 2 +- spec/unit/errors_spec.rb | 22 ++++++++++---------- spec/unit/request_execution_verifier_spec.rb | 2 +- spec/unit/response_spec.rb | 6 +++--- test/shared_test.rb | 4 ++-- test/test_helper.rb | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Gemfile b/Gemfile index f119ffa7b..193a6d457 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/spec/unit/errors_spec.rb b/spec/unit/errors_spec.rb index 1f642abd6..58c27a646 100644 --- a/spec/unit/errors_spec.rb +++ b/spec/unit/errors_spec.rb @@ -4,11 +4,11 @@ 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============================================================" @@ -16,12 +16,12 @@ 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============================================================" diff --git a/spec/unit/request_execution_verifier_spec.rb b/spec/unit/request_execution_verifier_spec.rb index 3aad61909..a10578b03 100644 --- a/spec/unit/request_execution_verifier_spec.rb +++ b/spec/unit/request_execution_verifier_spec.rb @@ -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 diff --git a/spec/unit/response_spec.rb b/spec/unit/response_spec.rb index 07fa63eb7..386378a85 100644 --- a/spec/unit/response_spec.rb +++ b/spec/unit/response_spec.rb @@ -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 diff --git a/test/shared_test.rb b/test/shared_test.rb index f73294551..747001d86 100644 --- a/test/shared_test.rb +++ b/test/shared_test.rb @@ -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 diff --git a/test/test_helper.rb b/test/test_helper.rb index 147615ef4..31bab38bb 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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