Rails3, Caypbara, Cucumber, FakeWeb…oh my….

November 5, 2010 Mike Gehard

While helping client upgrade a Rails 2.3.10 site to Rails 3.0.1, I came across a very perplexing problem with our WebDriver based Cucumber tests that all worked fine under 2.3.10.

We were “randomly” getting some very strange errors from Cucumber having to do with timeout problems and other strangeness like Cucumber not being able to find form fields to fill in.

The solution:
1) require => false for the FakeWeb line in the Gemfile
2) add require ‘fakeweb’ to the top of the test_helper.rb file

or optionally scrap FakeWeb for either Artifice or WebMock

It has something to do with FakeWeb inserting it into the HTTP stack strangely even if you tell it to allow non-local HTTP requests. We weren’t seeing it in 2.3.10 because we were using a cucumber environment to run the cucumber tests. Now under 3.0.1 we run the cucumber tests in the test environment.

I wish I had some more details but I was just happy to move past this strangeness so I didn’t really look back.

About the Author

Biography

Previous
Crowdsourcing with CrowdFlower
Crowdsourcing with CrowdFlower

CrowdFlower enables a quality, fast, large, global workforce to complete simple tasks. Brian O'Rourke and C...

Next
Pivotal Tracker hosting move this Saturday
Pivotal Tracker hosting move this Saturday

Tracker will be moving to a new hosting environment this weekend. This post contains updated information ab...