Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

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

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.

  1. Mat Schaffer says:

    What did you guys use to tell Artifice allow local requests? We had to do some interesting un-monkeypatching in our latest project for that. Is there a better way?

    Here’s the crux of what we did:

  2. Mike Gehard says:

    Sorry…we haven’t actually switched to Artifice yet so I can’t help with that.

  3. jari says:

    WebDriver’s internals do use Net::HTTP by default to communicate with the browsers. You can avoid the Net::HTTP stack completely by using the provided Curb client or your own implementation – check “Using Curb or your own HTTP client” here:

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *