Use define_method instead of class_eval
This commit is contained in:
parent
722da33114
commit
26f6c783a7
|
@ -47,11 +47,9 @@ module Capybara
|
|||
end
|
||||
|
||||
Session::DSL_METHODS.each do |method|
|
||||
class_eval <<-RUBY, __FILE__, __LINE__+1
|
||||
def #{method}(*args, &block)
|
||||
page.#{method}(*args, &block)
|
||||
end
|
||||
RUBY
|
||||
define_method method do |*args, &block|
|
||||
page.send method, *args, &block
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -338,12 +338,10 @@ module Capybara
|
|||
end
|
||||
|
||||
NODE_METHODS.each do |method|
|
||||
class_eval <<-RUBY, __FILE__, __LINE__+1
|
||||
def #{method}(*args, &block)
|
||||
@touched = true
|
||||
current_node.send(:#{method}, *args, &block)
|
||||
end
|
||||
RUBY
|
||||
define_method method do |*args, &block|
|
||||
@touched = true
|
||||
current_node.send(method, *args, &block)
|
||||
end
|
||||
end
|
||||
|
||||
def inspect
|
||||
|
|
Loading…
Reference in New Issue