Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Cucumber Rails

Isaac A. Murchie edited this page Jan 21, 2014 · 3 revisions

Tag your Cucumber features with @selenium and they'll run on Sauce. It's ( almost ) that easy! (NB: These docs are in addition to the Cucumber & Capybara docs)

The Rails integration gem for Cucumber has the potential to interfere with the current (2.3.1) version of sauce/cucumber. If you are using cucumber/rails, setting up your environment like this will ensure you get the expected behaviour.

Gemfile

group :test do
  gem "cucumber-rails", :require => false
  gem "sauce-cucumber", :require => false
end

Support files

You must require the sauce-cucumber gem after the cucumber-rails gem, otherwise Capybara integration will not function correctly.

# features/support/env.rb
require "capybara/rails"
require "sauce/cucumber"

Run some selenium tests locally

By default, tagging tests with @javascript will run them against the Capybara.javascript_driver. We set this to :sauce, so they will run against Sauce Labs OnDemand infrastructure.

To allow you to run these tests locally, set the Capybara.javascript_driver to :selenium after you require the sauce-cucumber gem:

Capybara.javascript_driver = :selenium

Now, any test tagged with @selenium will run on Sauce Labs. Any tagged with @javascript will run locally.