Skip to content

Instantly share code, notes, and snippets.

@glennfu
Created June 22, 2009 16:16
Show Gist options
  • Save glennfu/134050 to your computer and use it in GitHub Desktop.
Save glennfu/134050 to your computer and use it in GitHub Desktop.
default: -r features/support/env.rb -r features/support/plain.rb -r features/step_definitions features/plain --format progress features --tags ~@pending
selenium: -r features/support/env.rb -r features/support/enhanced.rb -r features/step_definitions features/enhanced features/plain --format progress features --tags ~@pending
Webrat.configure do |config|
config.mode = :selenium
# Selenium defaults to using the selenium environment. Use the following to override this.
# config.application_environment = :test
config.application_address = 'localhost'
config.application_port = 4444
end
# this is necessary to have webrat "wait_for" the response body to be available
# when writing steps that match against the response body returned by selenium
World(Webrat::Selenium::Matchers)
Before do
# truncate your tables here, since you can't use transactional fixtures*
User.destroy_all
end
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode support
require 'webrat'
require 'webrat/rails'
require 'cucumber/rails/rspec'
require 'webrat/core/matchers'
# truncate your tables here if you are using the same database as selenium, since selenium doesn't use transactional fixtures
Cucumber::Rails.use_transactional_fixtures
Webrat.configure do |config|
config.mode = :rails
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment