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:

[ruby]

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”

[/ruby]

The error that was shown is this:

[shell]

undefined local variable or method `node’ for #<Capybara::Driver::Node tag=“a” …

[/shell]

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:

[ruby]

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

[/ruby]

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.

Submit to Hacker News

[NOTE] This post has been imported to Hugo from a Wordpress blog. It may be broken, missing images, code snippets or other information.

[NOTE] updated November 23, 2010. It's 2844 days old . This article may have outdated content.