1
0
Fork 0

Use DatabaseCleaner

This commit is contained in:
Alex Kotov 2018-11-23 01:29:28 +05:00
parent 8d2e1edaea
commit 2c911d9cde
No known key found for this signature in database
GPG Key ID: 4E831250F47DE154
3 changed files with 18 additions and 0 deletions

View File

@ -82,6 +82,8 @@ group :development do
end
group :test do
gem 'database_cleaner', '~> 1.7'
# Code coverage for Ruby 1.9+ with a powerful configuration library
# and automatic merging of coverage across test suites.
gem 'simplecov', '~> 0.16', require: false

View File

@ -52,6 +52,7 @@ GEM
coderay (1.1.2)
concurrent-ruby (1.1.3)
crass (1.0.4)
database_cleaner (1.7.0)
diff-lcs (1.3)
docile (1.3.1)
erubi (1.7.1)
@ -214,6 +215,7 @@ PLATFORMS
DEPENDENCIES
bootsnap (>= 1.1.0)
byebug
database_cleaner (~> 1.7)
factory_bot_rails (~> 4.10)
faker (~> 1.8)
listen (>= 3.0.5, < 3.2)

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
RSpec.configure do |config|
config.before :suite do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with :truncation
end
config.around do |example|
DatabaseCleaner.cleaning do
example.run
end
end
end