Don't redefine Object method `method`.

The `Object` class in Ruby defines an instance method named `method`
that receives a symbol a returns a `Method` object. Byebug uses this
method to grab information about the parameters of each frame in the
backtrace.

The `Capybara::RackTest::Form` class defines a method called `method`,
overriding the method mentioned above. This case could probably be
rescued in `byebug`, but since the method is just a private utility
in the class, I think it is fine to just rename it to something else
inside capybara.

While renaming it, I noticed a typo in a variable name, so I made the
renamings so that the typo is corrected too.
This commit is contained in:
David Rodríguez 2015-11-09 01:06:15 +01:00
parent c9061cc5d4
commit 638852f343
1 changed files with 3 additions and 3 deletions

View File

@ -73,8 +73,8 @@ class Capybara::RackTest::Form < Capybara::RackTest::Node
def submit(button)
action = (button && button['formaction']) || native['action']
requset_method = (button && button['formmethod']) || method
driver.submit(requset_method, action.to_s, params(button))
method = (button && button['formmethod']) || request_method
driver.submit(method, action.to_s, params(button))
end
def multipart?
@ -89,7 +89,7 @@ private
end
end
def method
def request_method
self[:method] =~ /post/i ? :post : :get
end