A solution for the “I Follow” bug with cucumber and Capybara

While working on a new application and writing tests I encountered a problem:
This is the test I have been using:

  Scenario: Deleting a project from the main page
    Given I am on the account home page
	When I follow "Delete Project"
	Then I should see "Your project has been deleted"

The error that was shown is this:

undefined local variable or method `node' for #<Capybara::Driver::Node tag="a" ...

Here’s a screen shot of the test run:
Screen shot 2010-11-23 at 5.36.24 PM

After browsing around for quite some time, I found that the error is originated with this line in env.rb file:

require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript

Commenting out this line solved the problem for me and now I can continue with my testing. I hope it will solve your problem as well.

  • Pingback: Anonymous

  • Wes Sheldahl

    Thanks very much. I ran into exactly the same issue, and the solution worked for me as well.
    I’m using rails 2.3.5, cucumber 0.10.0, cucumber-4ails 0.3.2, and capybara 0.4.1.1.

    • http://www.kensodev.com Avi Tzurel

      Glad I could help

  • Anonymous

    Thank you for writing this up – I was running into the same error and your post has helped me get to my new app’s first passing test!

    • http://www.kensodev.com Avi Tzurel

      There’s nothing like seeing the green in your eyes. I am very glad I could help out :-)