mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Improves test speed
This commit is contained in:
parent
e3f5b48d26
commit
0496ed23e5
2 changed files with 20 additions and 4 deletions
|
|
@ -1,6 +1,16 @@
|
|||
RSpec.configure do |config|
|
||||
config.before(:each) do
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
Rails.application.load_seed
|
||||
end
|
||||
|
||||
config.before(:each) do |example|
|
||||
DatabaseCleaner.strategy = example.metadata[:js] == true ? :truncation : :transaction
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do |example|
|
||||
DatabaseCleaner.clean
|
||||
Rails.application.load_seed if example.metadata[:js] == true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,9 +4,15 @@ RSpec.configure do |config|
|
|||
|
||||
config.before(:suite) do
|
||||
if ENV['OSEM_FACTORY_LINT'] != 'false'
|
||||
mock_commercial_request
|
||||
FactoryGirl.lint
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
begin
|
||||
DatabaseCleaner.start
|
||||
mock_commercial_request
|
||||
FactoryGirl.lint
|
||||
ensure
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue