Skip to content

Commit

Permalink
Make click_with_javascript_emulation take any args
Browse files Browse the repository at this point in the history
During the "Delete Widgets" test, this happens:

    When I follow "Destroy"                 # features/step_definitions/web_steps.rb:48
      wrong number of arguments (given 2, expected 0) (ArgumentError)
      /Users/ryanbigg/code/gems/cucumber-rails/lib/cucumber/rails/capybara/javascript_emulation.rb:12:in `click_with_javascript_emulation'
      /usr/local/Cellar/asdf/0.4.1/installs/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-3.0.2/lib/capybara/node/element.rb:133:in `block in click'
      /usr/local/Cellar/asdf/0.4.1/installs/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-3.0.2/lib/capybara/node/base.rb:83:in `synchronize'
      /usr/local/Cellar/asdf/0.4.1/installs/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-3.0.2/lib/capybara/node/element.rb:133:in `click'
      /usr/local/Cellar/asdf/0.4.1/installs/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-3.0.2/lib/capybara/node/actions.rb:41:in `click_link'
      /usr/local/Cellar/asdf/0.4.1/installs/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-3.0.2/lib/capybara/session.rb:740:in `block (2 levels) in <class:Session>'
      /usr/local/Cellar/asdf/0.4.1/installs/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/capybara-3.0.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
      /Users/ryanbigg/code/gems/cucumber-rails/tmp/aruba/test_app/features/step_definitions/web_steps.rb:49:in `block in <main>'

  This is because Capybara 3 now passes two additional arguments to
  Cucumber's method. But this Cucumber method needs to do nothing with
  those arguments other than accept them.

  This will make the "Deleting a widget" test pass once again.
  • Loading branch information
Ryan Bigg committed Apr 19, 2018
1 parent cfcd0ea commit 1eb7267
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cucumber/rails/capybara/javascript_emulation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.included(base)
end
end

def click_with_javascript_emulation
def click_with_javascript_emulation(*args)
if link_with_non_get_http_method?
::Capybara::RackTest::Form.new(driver, js_form(element_node.document, self[:href], emulated_method)).submit(self)
else
Expand Down

0 comments on commit 1eb7267

Please sign in to comment.