Skip to content

Instantly share code, notes, and snippets.

@bmabey
Created June 4, 2009 01:09
Show Gist options
  • Save bmabey/123370 to your computer and use it in GitHub Desktop.
Save bmabey/123370 to your computer and use it in GitHub Desktop.
how to get spork working for cucumber in a rails app
require 'rubygems'
require 'spork'
Spork.prefork do
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "cucumber"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'webrat'
Webrat.configure do |config|
config.mode = :rails
end
require 'webrat/core/matchers'
require 'cucumber' # I needed to add this... We could move this require to Spork if we think it is better there...
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
require 'spec/rails' # I needed to add this as well to avoid the #records error...
require 'cucumber/rails/rspec'
end
Spork.each_run do
# This code will be run each time you run your specs.
require 'cucumber/rails/world'
Cucumber::Rails.use_transactional_fixtures
Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment