lib/webmock/webmock.rb in webmock-0.7.1 vs lib/webmock/webmock.rb in webmock-0.7.2

- old
+ new

@@ -1,51 +1,48 @@ -WebMock::Utility.record_loaded_net_http_replacement_libs -WebMock::Utility.puts_warning_for_net_http_around_advice_libs_if_needed - - module WebMock + extend self - def stub_request(method, url) - RequestRegistry.instance.register_request_stub(RequestStub.new(method, url)) + def stub_request(method, uri) + RequestRegistry.instance.register_request_stub(RequestStub.new(method, uri)) end alias_method :stub_http_request, :stub_request - def request(method, url) - RequestProfile.new(method, url) + def request(method, uri) + RequestProfile.new(method, uri) end - def assert_requested(method, url, options = {}) + def assert_requested(method, uri, options = {}) expected_times_executed = options.delete(:times) || 1 - request = RequestProfile.new(method, url, options[:body], options[:headers]) + request = RequestProfile.new(method, uri, options[:body], options[:headers]) verifier = RequestExecutionVerifier.new(request, expected_times_executed) assertion_failure(verifier.failure_message) unless verifier.matches? end - def assert_not_requested(method, url, options = {}) - request = RequestProfile.new(method, url, options[:body], options[:headers]) + def assert_not_requested(method, uri, options = {}) + request = RequestProfile.new(method, uri, options[:body], options[:headers]) verifier = RequestExecutionVerifier.new(request, options.delete(:times)) assertion_failure(verifier.negative_failure_message) unless verifier.does_not_match? end - def self.allow_net_connect! + def allow_net_connect! Config.instance.allow_net_connect = true end - def self.disable_net_connect! + def disable_net_connect! Config.instance.allow_net_connect = false end - def self.net_connect_allowed? + def net_connect_allowed? Config.instance.allow_net_connect end - def self.registered_request?(request_profile) - RequestRegistry.instance.registered_request?(request_profile) + def registered_request?(request_signature) + RequestRegistry.instance.registered_request?(request_signature) end - def self.response_for_request(request_profile, &block) - RequestRegistry.instance.response_for_request(request_profile, &block) + def response_for_request(request_signature, &block) + RequestRegistry.instance.response_for_request(request_signature, &block) end def reset_webmock WebMock::RequestRegistry.instance.reset_webmock end