Permalink
Browse files

Fixed compatibility with Curb >= 0.7.16 This breaks compatibility wit…

…h Curb =< 0.7.15
  • Loading branch information...
1 parent 0c17403 commit 02a9c1dcf4af727d26f760cdc71e85f3b419b12e @bblimke committed Jan 22, 2012
Showing with 5 additions and 42 deletions.
  1. +4 −41 lib/webmock/http_lib_adapters/curb_adapter.rb
  2. +1 −1 webmock.gemspec
@@ -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,19 +170,15 @@ 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
%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,19 +188,15 @@ 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
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
View
@@ -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')

0 comments on commit 02a9c1d

Please sign in to comment.