undefined method `visit’ for #<Cucumber::Rails::World:…> (NoMethodError)

I had the most obnoxious time troubleshooting this…advice varied wildly around the Internets. These were the applicable bits of my environment for my latest Ruby on Rails work (using Ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]):

I’d seen several other people had this same problem. Several of them solved the problem by changing the following in env.rb from:


This didn’t work for me, and I beat my head against the wall for hours trying to fix the problem. I finally created a new gemset, and rebuilt from scratch. This changed nothing. Then, I found this page. His instructions include a lot of unnecessary and outdated gems, though. So, followed his directions loosely–again with a fresh gemset–and did the following:

Reinstalled the latest Rails build:

Updated my Gemfile to:

Installed the bundled gems:

Checked what versions my dice roll had landed me with:

And got:

Finally, I installed autotest and friends:

And, voilá! I now have a fully-functional BDD development system again. The key? capybara. It seems that webrat just doesn’t play nicely with the latest Rails. Capybara is intended to be a drop-in replacement for webrat, and that it certainly is. BDD-away!

UPDATE: It seems that, as of 2.0.0.beta.20, RSpec and friends still require webrat (or need other configuring to work with Capybara–for which I don’t have time). Just add it to your Gemfile, bundle install, and away you go…