diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1d946224168..2e590e5747c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -241,7 +241,7 @@ jobs: if: matrix.build_type == 'system' && matrix.target == 'plugins' run: | GLOBIGNORE="plugins/chat/*"; - LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation plugins/*/spec/system + PREFABRICATION=0 LOAD_PLUGINS=1 RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error PARALLEL_TEST_PROCESSORS=4 bin/turbo_rspec --use-runtime-info --profile=50 --verbose --format documentation plugins/*/spec/system shell: bash timeout-minutes: 30 diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 72061733477..1674214dde4 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -61,8 +61,6 @@ require File.expand_path("../../config/environment", __FILE__) require "rspec/rails" require "shoulda-matchers" require "sidekiq/testing" -require "test_prof/recipes/rspec/let_it_be" -require "test_prof/before_all/adapters/active_record" require "selenium-webdriver" require "capybara/rails" @@ -156,20 +154,25 @@ module TestSetup end end -TestProf::BeforeAll.configure do |config| - config.after(:begin) do - DB.test_transaction = ActiveRecord::Base.connection.current_transaction - TestSetup.test_setup - end -end - -module Prefabrication - if ENV["PREFABRICATION"] == "0" +if ENV["PREFABRICATION"] == "0" + module Prefabrication def fab!(name, **opts, &blk) blk ||= proc { Fabricate(name) } let!(name, &blk) end - else + end +else + require "test_prof/recipes/rspec/let_it_be" + require "test_prof/before_all/adapters/active_record" + + TestProf::BeforeAll.configure do |config| + config.after(:begin) do + DB.test_transaction = ActiveRecord::Base.connection.current_transaction + TestSetup.test_setup + end + end + + module Prefabrication def fab!(name, **opts, &blk) blk ||= proc { Fabricate(name) } let_it_be(name, refind: true, **opts, &blk) @@ -177,8 +180,6 @@ module Prefabrication end end -RSpec.configure { |config| config.extend Prefabrication } - PER_SPEC_TIMEOUT_SECONDS = 45 BROWSER_READ_TIMEOUT = 30 @@ -186,6 +187,7 @@ RSpec.configure do |config| config.fail_fast = ENV["RSPEC_FAIL_FAST"] == "1" config.silence_filter_announcements = ENV["RSPEC_SILENCE_FILTER_ANNOUNCEMENTS"] == "1" config.extend RedisSnapshotHelper + config.extend Prefabrication config.include Helpers config.include MessageBus config.include RSpecHtmlMatchers