added database_cleaner

This commit is contained in:
nilsding 2014-11-18 19:58:14 +01:00
parent 76e6b8f5ec
commit c4d48190b6
4 changed files with 26 additions and 6 deletions

View File

@ -28,7 +28,6 @@ gem 'nprogress-rails'
gem 'font-awesome-rails', '~> 4.2.0.0'
group :development do
gem 'thin'
gem 'spring'
end
@ -37,12 +36,13 @@ group :production do
end
group :development, :test do
gem 'thin'
gem 'rspec-rails', '~> 3.0.0'
gem 'shoulda-matchers'
gem 'factory_girl_rails'
gem 'faker'
gem 'capybara'
gem 'poltergeist'
gem 'simplecov'
gem 'database_cleaner'
end

View File

@ -50,6 +50,7 @@ GEM
execjs
coffee-script-source (1.8.0)
daemons (1.1.9)
database_cleaner (1.3.0)
devise (3.4.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
@ -155,8 +156,6 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
shoulda-matchers (2.7.0)
activesupport (>= 3.0.0)
simplecov (0.9.1)
docile (~> 1.1.0)
multi_json (~> 1.0)
@ -207,6 +206,7 @@ DEPENDENCIES
bootstrap_form
capybara
coffee-rails (~> 4.1.0)
database_cleaner
devise
factory_girl_rails
faker
@ -225,7 +225,6 @@ DEPENDENCIES
rspec-rails (~> 3.0.0)
sass-rails (~> 4.0.3)
sdoc (~> 0.4.1)
shoulda-matchers
simplecov
spring
thin

View File

@ -24,7 +24,7 @@ RSpec.configure do |config|
# 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
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and

View File

@ -0,0 +1,21 @@
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with :truncation
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end