Blob Blame History Raw
From 286f37fdce0a0e6ea460edd0d26e7bff810ba576 Mon Sep 17 00:00:00 2001
From: Ryan Bigg <ryanbigg@cultureamp.com>
Date: Thu, 19 Apr 2018 16:28:50 +1000
Subject: [PATCH] Make click_with_javascript_emulation take any args

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.
---
 lib/cucumber/rails/capybara/javascript_emulation.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/cucumber/rails/capybara/javascript_emulation.rb b/lib/cucumber/rails/capybara/javascript_emulation.rb
index 9575234..8202b53 100644
--- a/lib/cucumber/rails/capybara/javascript_emulation.rb
+++ b/lib/cucumber/rails/capybara/javascript_emulation.rb
@@ -9,7 +9,7 @@ def self.included(base)
           end
         end
 
-        def click_with_javascript_emulation
+        def click_with_javascript_emulation(*)
           if link_with_non_get_http_method?
             ::Capybara::RackTest::Form.new(driver, js_form(element_node.document, self[:href], emulated_method)).submit(self)
           else