Sha256: a0eef6d4e1eef109a5632a42d61fb5bc597cac4d51448329dd81e606b338f50e

Contents?: true

Size: 622 Bytes

Versions: 2

Compression:

Stored size: 622 Bytes

Contents

require 'spec_helper'

describe EndpointStub, endpoint_stub_spec: true do
  describe '.activate!' do
    it 'should make http requests raise WebMock::NetConnectNotAllowedError' do
      EndpointStub.activate!
      expect{Net::HTTP.get "test.com", "/nothing"}.to raise_error WebMock::NetConnectNotAllowedError
    end
  end

  describe '.deactivate!' do
    it 'should allow http requests once again' do
      # TODO make this account for not being connected to the internet.
      EndpointStub.activate!
      EndpointStub.deactivate!
      expect{Net::HTTP.get "example.com", "/foo"}.to_not raise_error
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
endpoint_stub-1.4.5 spec/endpoint_stub_spec.rb
endpoint_stub-1.1.0 spec/endpoint_stub_spec.rb