Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

131 lines
5.0 KiB
Ruby
Raw Permalink Normal View History

2025-08-19 17:03:57 +01:00
# frozen_string_literal: true
#-- copyright
2020-01-15 11:31:26 +01:00
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
2013-09-16 17:59:31 +02:00
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
2021-01-13 17:47:45 +01:00
# Copyright (C) 2006-2013 Jean-Philippe Lang
2013-09-16 17:59:31 +02:00
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
2024-11-19 15:52:21 +01:00
require "active_support/core_ext/integer/time"
require "appsignal" # we will need it to test it in `spec/lib/open_project/appsignal_spec.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!
Rails.application.configure do
2015-06-06 14:21:26 +02:00
# Settings specified here will take precedence over those in config/application.rb.
# Access to rack session
config.middleware.use RackSessionAccess::Middleware
# Spring requires to have the classes reloaded. On the CI or when Spring is
# disabled, it does not need to happen.
2024-01-30 14:59:34 +02:00
config.enable_reloading = %w[CI DISABLE_SPRING].none? { |name| ENV[name].present? }
# Eager loading loads your entire application. When running a single test locally,
# this is usually not necessary, and can slow down your test suite. However, it's
# recommended that you enable it in continuous integration systems to ensure eager
# loading is working properly before deploying your code.
2024-01-30 14:59:34 +02:00
config.eager_load = %w[CI EAGER_LOAD].any? { |name| ENV[name].present? }
# Configure public file server for tests with Cache-Control for performance.
2016-09-26 14:20:19 +02:00
config.public_file_server.enabled = true
2024-11-19 15:52:21 +01:00
config.public_file_server.headers = { "Cache-Control" => "public, max-age=3600" }
2015-06-06 14:21:26 +02:00
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = true
# Render exception templates for rescuable exceptions and raise for other exceptions.
config.action_dispatch.show_exceptions = :none
2022-04-05 14:21:00 +02:00
# Enable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = true
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
config.action_mailer.perform_caching = false
# 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
2023-04-03 16:31:39 +03:00
# Silence deprecations early on for testing on CI
2024-11-19 15:52:21 +01:00
deprecators.silenced = ENV["CI"].present?
2023-04-03 16:31:39 +03:00
2015-06-06 14:21:26 +02:00
# Print deprecation notices to the stderr.
2021-02-02 15:33:33 +01:00
config.active_support.deprecation =
2024-11-19 15:52:21 +01:00
if ENV["CI"]
2021-02-02 15:33:33 +01:00
:silence
else
:stderr
end
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
2016-05-18 21:18:29 +02:00
# Disable asset digests
2016-05-21 20:00:01 +02:00
config.assets.compile = true
config.assets.compress = false
2016-05-18 21:18:29 +02:00
config.assets.digest = false
2016-05-21 20:00:01 +02:00
config.assets.debug = false
2016-05-18 21:18:29 +02:00
# Raises error for missing translations.
config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
config.cache_store = :file_store, Rails.root.join("tmp", "cache", "paralleltests#{ENV.fetch('TEST_ENV_NUMBER', nil)}")
2023-11-06 15:20:21 +01:00
# Use in-memory store for testing
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
2024-11-19 15:52:21 +01:00
if ENV["TEST_ENV_NUMBER"]
assets_cache_path = Rails.root.join("tmp/cache/assets/paralleltests#{ENV['TEST_ENV_NUMBER']}")
2016-05-17 21:34:50 +02:00
config.assets.cache = Sprockets::Cache::FileStore.new(assets_cache_path)
end
# Speed up tests by lowering BCrypt's cost function
BCrypt::Engine.cost = BCrypt::Engine::MIN_COST
2024-11-19 15:52:21 +01:00
# use ActiveJob test adapter
config.active_job.queue_adapter = :test
end