2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
require 'gitlab/testing/request_blocker_middleware'
|
2020-11-24 15:15:51 +05:30
|
|
|
require 'gitlab/testing/robots_blocker_middleware'
|
2020-04-08 14:13:33 +05:30
|
|
|
require 'gitlab/testing/request_inspector_middleware'
|
2020-05-24 23:13:21 +05:30
|
|
|
require 'gitlab/testing/clear_process_memory_cache_middleware'
|
|
|
|
require 'gitlab/utils'
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
Rails.application.configure do
|
2017-08-17 22:00:37 +05:30
|
|
|
# Make sure the middleware is inserted first in middleware chain
|
2018-11-08 19:23:39 +05:30
|
|
|
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RequestBlockerMiddleware)
|
2020-11-24 15:15:51 +05:30
|
|
|
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RobotsBlockerMiddleware)
|
2018-11-08 19:23:39 +05:30
|
|
|
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::RequestInspectorMiddleware)
|
2020-05-24 23:13:21 +05:30
|
|
|
config.middleware.insert_before(ActionDispatch::Static, Gitlab::Testing::ClearProcessMemoryCacheMiddleware)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
# Settings specified here will take precedence over those in config/application.rb
|
|
|
|
|
|
|
|
# The test environment is used exclusively to run your application's
|
|
|
|
# test suite. You never need to work with it otherwise. Remember that
|
|
|
|
# your test database is "scratch space" for the test suite and is wiped
|
|
|
|
# and recreated between test runs. Don't rely on the data there!
|
2021-01-29 00:20:46 +05:30
|
|
|
config.cache_classes = Gitlab::Utils.to_boolean(ENV['CACHE_CLASSES'], default: false)
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
# Configure static asset server for tests with Cache-Control for performance
|
2018-03-17 18:26:18 +05:30
|
|
|
config.assets.compile = false if ENV['CI']
|
2021-06-08 01:23:25 +05:30
|
|
|
# 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-05-09 12:01:36 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
config.public_file_server.enabled = true
|
|
|
|
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
# Show full error reports and disable caching
|
2019-09-30 21:07:59 +05:30
|
|
|
config.active_record.verbose_query_logs = true
|
2014-09-02 18:07:02 +05:30
|
|
|
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-06-02 11:05:42 +05:30
|
|
|
config.action_controller.allow_forgery_protection = false
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
# Print deprecation notices to the stderr
|
|
|
|
config.active_support.deprecation = :stderr
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
config.eager_load = Gitlab::Utils.to_boolean(ENV['GITLAB_TEST_EAGER_LOAD'], default: true)
|
2015-11-26 14:37:03 +05:30
|
|
|
|
|
|
|
config.cache_store = :null_store
|
2015-12-23 02:04:40 +05:30
|
|
|
|
|
|
|
config.active_job.queue_adapter = :test
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
if ENV['CI'] && !ENV['RAILS_ENABLE_TEST_LOG']
|
|
|
|
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(nil))
|
|
|
|
config.log_level = :fatal
|
|
|
|
end
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
# Mount the ActionCable Engine in-app so that we don't have to spawn another Puma
|
|
|
|
# process for feature specs
|
|
|
|
ENV['ACTION_CABLE_IN_APP'] = 'true'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|