2021-02-03 16:09:17 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-20 16:08:48 -05:00
|
|
|
require 'gitlab/testing/request_blocker_middleware'
|
2020-09-15 20:09:37 -04:00
|
|
|
require 'gitlab/testing/robots_blocker_middleware'
|
2020-02-20 16:08:48 -05:00
|
|
|
require 'gitlab/testing/request_inspector_middleware'
|
2020-05-06 17:10:00 -04:00
|
|
|
require 'gitlab/testing/clear_process_memory_cache_middleware'
|
2020-05-14 11:08:14 -04:00
|
|
|
require 'gitlab/utils'
|
2020-02-20 16:08:48 -05:00
|
|
|
|
2015-11-25 11:18:44 -05:00
|
|
|
Rails.application.configure do
|
2017-03-09 21:28:20 -05:00
|
|
|
# Make sure the middleware is inserted first in middleware chain
|
2018-06-12 23:12:38 -04:00
|
|
|
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RequestBlockerMiddleware)
|
2020-09-15 20:09:37 -04:00
|
|
|
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RobotsBlockerMiddleware)
|
2018-06-12 23:12:38 -04:00
|
|
|
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RequestInspectorMiddleware)
|
2020-05-06 17:10:00 -04:00
|
|
|
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::ClearProcessMemoryCacheMiddleware)
|
2017-03-09 21:28:20 -05:00
|
|
|
|
2011-10-08 17:36:38 -04:00
|
|
|
# Settings specified here will take precedence over those in config/application.rb
|
|
|
|
|
|
|
|
# The test environment is used exclusively to run your application's
|
2012-11-14 08:45:15 -05:00
|
|
|
# test suite. You never need to work with it otherwise. Remember that
|
2011-10-08 17:36:38 -04:00
|
|
|
# your test database is "scratch space" for the test suite and is wiped
|
2012-11-14 08:45:15 -05:00
|
|
|
# and recreated between test runs. Don't rely on the data there!
|
2020-11-09 01:09:23 -05:00
|
|
|
config.cache_classes = Gitlab::Utils.to_boolean(ENV['CACHE_CLASSES'], default: false)
|
2011-10-08 17:36:38 -04:00
|
|
|
|
2022-08-01 08:12:10 -04:00
|
|
|
config.view_component.preview_route = "/-/view_component/previews"
|
|
|
|
|
2011-10-08 17:36:38 -04:00
|
|
|
# Configure static asset server for tests with Cache-Control for performance
|
2017-10-03 10:47:56 -04:00
|
|
|
config.assets.compile = false if ENV['CI']
|
2021-05-10 23:10:35 -04:00
|
|
|
# There is no need to check if assets are precompiled locally
|
|
|
|
# To debug AssetNotPrecompiled errors locally, set CHECK_PRECOMPILED_ASSETS to true
|
|
|
|
config.assets.check_precompiled_asset = Gitlab::Utils.to_boolean(ENV['CHECK_PRECOMPILED_ASSETS'], default: false)
|
2018-03-21 18:37:57 -04:00
|
|
|
|
2018-12-07 13:15:06 -05:00
|
|
|
config.public_file_server.enabled = true
|
|
|
|
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
2018-03-21 18:37:57 -04:00
|
|
|
|
2011-10-08 17:36:38 -04:00
|
|
|
# Show full error reports and disable caching
|
2019-06-25 13:54:42 -04:00
|
|
|
config.active_record.verbose_query_logs = true
|
2011-10-08 17:36:38 -04:00
|
|
|
config.consider_all_requests_local = true
|
|
|
|
config.action_controller.perform_caching = false
|
|
|
|
|
|
|
|
# Raise exceptions instead of rendering exception templates
|
|
|
|
config.action_dispatch.show_exceptions = false
|
|
|
|
|
|
|
|
# Disable request forgery protection in test environment
|
2016-05-10 22:58:06 -04:00
|
|
|
config.action_controller.allow_forgery_protection = false
|
2011-10-08 17:36:38 -04:00
|
|
|
|
|
|
|
# Tell Action Mailer not to deliver emails to the real world.
|
|
|
|
# The :test delivery method accumulates sent emails in the
|
|
|
|
# ActionMailer::Base.deliveries array.
|
|
|
|
config.action_mailer.delivery_method = :test
|
|
|
|
|
2022-09-13 11:12:17 -04:00
|
|
|
config.action_mailer.preview_path = GitlabEdition.path_glob('app/mailers/previews')
|
|
|
|
|
2011-10-08 17:36:38 -04:00
|
|
|
# Print deprecation notices to the stderr
|
|
|
|
config.active_support.deprecation = :stderr
|
2013-12-06 10:04:18 -05:00
|
|
|
|
2022-07-20 23:08:53 -04:00
|
|
|
# Raise exceptions for disallowed deprecations.
|
|
|
|
config.active_support.disallowed_deprecation = :raise
|
|
|
|
|
2021-10-26 05:09:57 -04:00
|
|
|
config.eager_load = Gitlab::Utils.to_boolean(ENV['GITLAB_TEST_EAGER_LOAD'], default: ENV['CI'].present?)
|
2015-11-16 05:18:31 -05:00
|
|
|
|
|
|
|
config.cache_store = :null_store
|
2015-11-30 04:21:10 -05:00
|
|
|
|
|
|
|
config.active_job.queue_adapter = :test
|
2017-07-13 10:51:37 -04:00
|
|
|
|
|
|
|
if ENV['CI'] && !ENV['RAILS_ENABLE_TEST_LOG']
|
2017-07-20 04:39:21 -04:00
|
|
|
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(nil))
|
2017-07-13 10:51:37 -04:00
|
|
|
config.log_level = :fatal
|
|
|
|
end
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|