Skip to content

Instantly share code, notes, and snippets.

@fivetwentysix
Created September 7, 2011 03:41
Show Gist options
  • Save fivetwentysix/1199710 to your computer and use it in GitHub Desktop.
Save fivetwentysix/1199710 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails'
require 'capybara/rspec'
require 'capybara/rails'
require 'factory_girl_rails'
require 'factory_girl'
require 'factory_girl/step_definitions'
Capybara.default_selector = :css
Capybara.javascript_driver = :webkit
Capybara.default_wait_time = 5
end
Spork.each_run do
# This code will be run each time you run your specs.
ActionController::Base.allow_rescue = false
begin
DatabaseCleaner.strategy = :truncation
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
Before do
DatabaseCleaner.start
end
After do
DatabaseCleaner.clean
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment