Skip to content

Instantly share code, notes, and snippets.

@oliverbarnes
Created March 4, 2011 19:58
Show Gist options
  • Save oliverbarnes/855604 to your computer and use it in GitHub Desktop.
Save oliverbarnes/855604 to your computer and use it in GitHub Desktop.
Cucumber setup with spork and database_cleaner for mongo_mapper
require 'rubygems'
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
...cucumber and capybara requires...
require 'database_cleaner'
require 'database_cleaner/cucumber'
require 'database_cleaner/mongo_mapper/truncation'
DatabaseCleaner.strategy = :truncation
end
Spork.each_run do
ActionController::Base.allow_rescue = false
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