Skip to content

Commit

Permalink
Specs: Use database_cleaner to ensure we start with an empty DB each …
Browse files Browse the repository at this point in the history
…time
  • Loading branch information
etdsoft committed Jun 21, 2012
1 parent ac93c76 commit ebcc111
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -33,6 +33,7 @@ gem 'rubyzip', '~> 0.9.6.1'
gem 'rspec-rails', :group => [:development, :test]

group :test do
gem 'database_cleaner'
gem 'factory_girl', '~> 2.6.4'
gem 'capybara'
gem 'guard-rspec'
Expand Down
15 changes: 14 additions & 1 deletion spec/spec_helper.rb
Expand Up @@ -26,5 +26,18 @@
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
config.use_transactional_fixtures = false

config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end

config.before(:each) do
DatabaseCleaner.start
end

config.after(:each) do
DatabaseCleaner.clean
end
end

0 comments on commit ebcc111

Please sign in to comment.