Sha256: c48b4e2c664686ea5e8382861114ce1e99a1977861718f4602393c125ead4162

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/test_helper')

  describe "Webmock" do
    include HttpRequestTestHelper

    before do
      stub_http_request(:any, "http://www.example.com")
      stub_http_request(:any, "https://www.example.com")
    end

    it "should raise error on non stubbed request" do
      lambda { http_request(:get, "http://www.example.net/") }.must_raise(WebMock::NetConnectNotAllowedError)
    end

    it "should verify that expected request occured" do
      http_request(:get, "http://www.example.com/")
      assert_requested(:get, "http://www.example.com", :times => 1)
      assert_requested(:get, "http://www.example.com")
    end

    it  "should verify that expect request didn't occur" do
     expected_message = "The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times"
     expected_message << "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
     assert_fail(expected_message) do
       assert_requested(:get, "http://www.example.com")
     end
    end

  end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
webmock-1.7.10 minitest/webmock_spec.rb
webmock-1.7.8 minitest/webmock_spec.rb
webmock-1.7.7 minitest/webmock_spec.rb
webmock-1.7.6 minitest/webmock_spec.rb
webmock-1.7.5 minitest/webmock_spec.rb
webmock-1.7.4 minitest/webmock_spec.rb
webmock-1.7.3 minitest/webmock_spec.rb
webmock-1.7.2 minitest/webmock_spec.rb
webmock-1.7.1 minitest/webmock_spec.rb
webmock-1.7.0 minitest/webmock_spec.rb