configures database_cleaner

This commit is contained in:
rgarcia
2015-07-25 18:11:12 +02:00
parent b674e109a5
commit 26b16ee874
3 changed files with 19 additions and 0 deletions

View File

@@ -50,3 +50,7 @@ group :development, :test do
gem 'factory_girl_rails' gem 'factory_girl_rails'
end end
group :test do
gem 'database_cleaner'
end

View File

@@ -66,6 +66,7 @@ GEM
execjs execjs
coffee-script-source (1.9.1.1) coffee-script-source (1.9.1.1)
columnize (0.9.0) columnize (0.9.0)
database_cleaner (1.4.1)
debug_inspector (0.0.2) debug_inspector (0.0.2)
devise (3.5.1) devise (3.5.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
@@ -203,6 +204,7 @@ DEPENDENCIES
byebug byebug
capybara capybara
coffee-rails (~> 4.1.0) coffee-rails (~> 4.1.0)
database_cleaner
devise devise
factory_girl_rails factory_girl_rails
foundation-rails foundation-rails

View File

@@ -4,6 +4,19 @@ RSpec.configure do |config|
config.run_all_when_everything_filtered = true config.run_all_when_everything_filtered = true
config.include FactoryGirl::Syntax::Methods config.include FactoryGirl::Syntax::Methods
config.before(:suite) do
DatabaseCleaner.clean_with :truncation
DatabaseCleaner.strategy = :transaction
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
# Allows RSpec to persist some state between runs in order to support # Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. # the `--only-failures` and `--next-failure` CLI options.
config.example_status_persistence_file_path = "spec/examples.txt" config.example_status_persistence_file_path = "spec/examples.txt"