Skip to content

Commit

Permalink
Fix syntax errros in 1.8.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
phiggins committed Oct 13, 2010
1 parent aa22f38 commit 38bbe44
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lib/webmock/http_lib_adapters/curb.rb
Expand Up @@ -195,35 +195,38 @@ def header_str_with_webmock
alias :header_str :header_str_with_webmock

%w[ success failure header body complete progress ].each do |callback|
define_method "on_#{callback}_with_webmock" do |&block|
instance_variable_set( "@on_#{callback}", block )
send( "on_#{callback}_without_webmock", &block )
end
class_eval <<-METHOD, __FILE__, __LINE__
def on_#{callback}_with_webmock &block
@on_#{callback} = block
on_#{callback}_without_webmock &block
end
METHOD
alias_method "on_#{callback}_without_webmock", "on_#{callback}"
alias_method "on_#{callback}", "on_#{callback}_with_webmock"
end


class << self
%w[ http_get http_head http_delete perform ].each do |method|
define_method(method) do |url, &block|
%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.send("#{method}")
c
end
end
METHOD
end

%w[ put post ].each do |verb|
define_method("http_#{verb}") do |url, data, &block|
%w[ put post ].each do |verb|
class_eval <<-METHOD, __FILE__, __LINE__
def self.http_#{verb}(url, data, &block)
c = new
c.url = url
block.call(c) if block
c.send("http_#{verb}", data)
c
end
end
METHOD
end

module WebmockHelper
Expand Down

0 comments on commit 38bbe44

Please sign in to comment.