Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

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

Mike Gehard
Thursday, November 4, 2010

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.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

3 Comments

  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: https://gist.github.com/664127

    November 5, 2010 at 6:15 am

  2. Mike Gehard says:

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

    November 5, 2010 at 4:50 pm

  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:

    http://code.google.com/p/selenium/wiki/RubyBindings

    November 6, 2010 at 2:58 am

Add New Comment Cancel reply

Your email address will not be published.

Mike Gehard

Mike Gehard
Boulder

Recent Posts

  • Using Jasmine to test CoffeeScript in a Rails 3.1 App
  • Waiting for jQuery Ajax calls to finish in Cucumber
  • Mocking Fog when using it with Carrierwave
Subscribe to Mike's Feed

Author Topics

coffeescript (1)
rails3 (10)
capybara (6)
cucumber (12)
javascript (2)
jquery (1)
webdriver (5)
carrierwave (1)
fog (1)
s3 (2)
testing (1)
rspec2 (3)
omniauth (1)
ruby (5)
devise (1)
aruba (2)
generators (2)
solr (1)
sunspot (1)
concerns (1)
mixins (1)
resque (1)
thin (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >