Only load seeds once while testing

Since we use transactions now for every test, we can seed the database
at the beginning, and then it will go back to this state before a test
is executed.

Running the test suite is now considerably faster. On my machine, we
save a quarter of second per system test, meaning we save several
minutes for the whole suite.
This commit is contained in:
Javi Martín
2019-07-10 01:51:03 +02:00
parent 1c8a49615a
commit e6c747c96c

View File

@@ -20,11 +20,14 @@ RSpec.configure do |config|
config.include(CommonActions)
config.include(ActiveSupport::Testing::TimeHelpers)
config.before(:suite) do
Rails.application.load_seed
end
config.before do |example|
I18n.locale = :en
Globalize.locale = nil
Globalize.set_fallbacks_to_all_available_locales
load Rails.root.join("db", "seeds.rb").to_s
Setting["feature.user.skip_verification"] = nil
end