Sha256: c5a603ed7db23797922c5057595091dde8df48e3799f98f507fab4efd8e25ca7

Contents?: true

Size: 1.62 KB

Versions: 34

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

describe "errors" do
  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"))
        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"))
        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============================================================"
        WebMock::NetConnectNotAllowedError.new(request_signature).message.should == expected
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 3 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/webmock-1.8.11/spec/unit/errors_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/webmock-1.8.11/spec/unit/errors_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/webmock-1.8.11/spec/unit/errors_spec.rb
webmock-1.13.0 spec/unit/errors_spec.rb
webmock-1.12.3 spec/unit/errors_spec.rb
webmock-1.12.2 spec/unit/errors_spec.rb
webmock-1.12.1 spec/unit/errors_spec.rb
webmock-1.12.0 spec/unit/errors_spec.rb
webmock-1.11.0 spec/unit/errors_spec.rb
webmock-1.10.2 spec/unit/errors_spec.rb
webmock-1.10.1 spec/unit/errors_spec.rb
webmock-1.10.0 spec/unit/errors_spec.rb
webmock-1.9.3 spec/unit/errors_spec.rb
webmock-1.9.2 spec/unit/errors_spec.rb
webmock-1.9.1 spec/unit/errors_spec.rb
simple-client-0.0.3 vendor/bundle/ruby/1.9.1/gems/webmock-1.8.8/spec/unit/errors_spec.rb
webmock-1.9.0 spec/unit/errors_spec.rb
webmock-1.8.11 spec/unit/errors_spec.rb
webmock-1.8.10 spec/unit/errors_spec.rb
webmock-1.8.9 spec/unit/errors_spec.rb