diff --git a/lib/webmock/http_lib_adapters/curb_adapter.rb b/lib/webmock/http_lib_adapters/curb_adapter.rb index 17b893461..9f36482af 100644 --- a/lib/webmock/http_lib_adapters/curb_adapter.rb +++ b/lib/webmock/http_lib_adapters/curb_adapter.rb @@ -53,6 +53,7 @@ def self.parse_header_string(header_string) module Curl class WebMockCurlEasy < Curl::Easy def curb_or_webmock + request_signature = build_request_signature WebMock::RequestRegistry.instance.requested_signatures.put(request_signature) @@ -169,9 +170,7 @@ def build_webmock_response def http_with_webmock(method) @webmock_method = method - curb_or_webmock do http_without_webmock(method) - end end alias_method :http_without_webmock, :http alias_method :http, :http_with_webmock @@ -179,9 +178,7 @@ def http_with_webmock(method) %w[ get head delete ].each do |verb| define_method "http_#{verb}_with_webmock" do @webmock_method = verb - curb_or_webmock do - send( "http_#{verb}_without_webmock" ) - end + send( "http_#{verb}_without_webmock" ) end alias_method "http_#{verb}_without_webmock", "http_#{verb}" @@ -191,9 +188,7 @@ def http_with_webmock(method) def http_put_with_webmock data = nil @webmock_method = :put @put_data = data if data - curb_or_webmock do - http_put_without_webmock(data) - end + http_put_without_webmock(data) end alias_method :http_put_without_webmock, :http_put alias_method :http_put, :http_put_with_webmock @@ -201,9 +196,7 @@ def http_put_with_webmock data = nil def http_post_with_webmock *data @webmock_method = :post @post_body = data.join('&') if data && !data.empty? - curb_or_webmock do - http_post_without_webmock(*data) - end + http_post_without_webmock(*data) end alias_method :http_post_without_webmock, :http_post alias_method :http_post, :http_post_with_webmock @@ -287,36 +280,6 @@ def on_#{callback}_with_webmock &block alias_method "on_#{callback}_without_webmock", "on_#{callback}" alias_method "on_#{callback}", "on_#{callback}_with_webmock" end - - %w[ http_get http_head http_delete perform ].each do |method| - class_eval <<-METHOD, __FILE__, __LINE__ - def self.#{method}(url, &block) - c = new - c.url = url - block.call(c) if block - c.send("#{method}") - c - end - METHOD - end - - class_eval <<-METHOD, __FILE__, __LINE__ - def self.http_put(url, data, &block) - c = new - c.url = url - block.call(c) if block - c.send(:http_put, data) - c - end - - def self.http_post(url, *data, &block) - c = new - c.url = url - block.call(c) if block - c.send(:http_post, *data) - c - end - METHOD end end end diff --git a/webmock.gemspec b/webmock.gemspec index fcdbddabd..6dcf9fa25 100644 --- a/webmock.gemspec +++ b/webmock.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'httpclient', '>= 2.2.4' s.add_development_dependency 'patron', '>= 0.4.17' s.add_development_dependency 'em-http-request', '~> 0.3.0' - s.add_development_dependency 'curb', '0.7.15' + s.add_development_dependency 'curb', '>= 0.8.0' s.add_development_dependency 'typhoeus', '>= 0.3.0' s.add_development_dependency 'minitest', '>= 2.2.2' s.add_development_dependency 'rdoc', ((RUBY_VERSION == '1.8.6') ? '<= 3.5.0' : '>3.5.0')