mattgreen/webstub

View on GitHub
lib/webstub/api.rb

Summary

Maintainability
A
0 mins
Test Coverage
module WebStub
  module API
    extend self

    def disable_network_access!
      protocol.disable_network_access!
    end

    def enable_network_access!
      protocol.enable_network_access!
    end

    def stub_request(method, path)
      protocol.add_stub(method, path)
    end

    def reset_stubs
      protocol.reset_stubs
    end

    private

    def protocol
      Dispatch.once { NSURLProtocol.registerClass(WebStub::Protocol) }

      Protocol
    end
  end
end