2020-02-20 16:08:48 -05:00
|
|
|
require 'gitlab/testing/request_blocker_middleware'
|
|
|
|
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)
|
|
|
|
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!
|
2017-04-14 17:54:36 -04:00
|
|
|
|
2020-01-20 07:09:02 -05:00
|
|
|
# Code doesn't change in CI so we don't need code-reloading
|
|
|
|
config.cache_classes = !!ENV['CI']
|
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']
|
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
|
|
|
|
|
|
|
|
# Print deprecation notices to the stderr
|
|
|
|
config.active_support.deprecation = :stderr
|
2013-12-06 10:04:18 -05:00
|
|
|
|
2020-05-14 11:08:14 -04:00
|
|
|
config.eager_load = Gitlab::Utils.to_boolean(ENV['GITLAB_TEST_EAGER_LOAD'], default: true)
|
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
|
2020-07-08 02:09:13 -04:00
|
|
|
|
|
|
|
# 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'
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|