From e6c747c96ce30088f3655ef37e7e31fbe386a906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 10 Jul 2019 01:51:03 +0200 Subject: [PATCH] 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. --- spec/spec_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4a1956218..ff616c6e9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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