mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Improvements in the DatabaseCleaner
Move all what is related to the DatabaseCleaner to the database_cleaner.rb file. Load the seeds only when they have been deleted and not before every test.
This commit is contained in:
parent
052cfebf4e
commit
7ebf44d1e4
2 changed files with 7 additions and 11 deletions
|
|
@ -55,13 +55,6 @@ RSpec.configure do |config|
|
|||
# --seed 1234
|
||||
config.order = 'random'
|
||||
|
||||
config.around(:each) do |example|
|
||||
DatabaseCleaner.cleaning do
|
||||
Rails.application.load_seed
|
||||
example.run
|
||||
end
|
||||
end
|
||||
|
||||
# poltergeist as a underlying mech for Capybara
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
RSpec.configure do |config|
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
Rails.application.load_seed
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
config.before(:each) do |example|
|
||||
DatabaseCleaner.strategy = (example.metadata[:js] == true) ? :truncation : :transaction
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.before(:each, js: true) do
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
config.after(:each) do |example|
|
||||
DatabaseCleaner.clean
|
||||
Rails.application.load_seed if example.metadata[:js] == true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue