summaryrefslogtreecommitdiff
path: root/config/environments
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-04-14 14:54:36 -0700
committerStan Hu <stanhu@gmail.com>2017-04-14 15:13:31 -0700
commit00dd2ba95e9607ce4a1cd1a19aecee9b3e083768 (patch)
treed119fd13a9602206cba156792330e6b93ca6e540 /config/environments
parent1cc2d2ecb6d809fba5c1aa17c5f7b3b55d65414d (diff)
downloadgitlab-ce-00dd2ba95e9607ce4a1cd1a19aecee9b3e083768.tar.gz
Turn on caching of classes in Knapsack specs
Enabling caching of classes slows start-up time because all controllers are loaded at initialization, but it reduces memory and load because files are not reloaded with every request. For example, caching is not necessary for loading database migrations but useful for handling Knapsack specs. Addresses gitlab-org/gitlab-ee#2162
Diffstat (limited to 'config/environments')
-rw-r--r--config/environments/test.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/config/environments/test.rb b/config/environments/test.rb
index a25c5016a3b..c3b788c038e 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -8,7 +8,12 @@ Rails.application.configure do
# 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!
- config.cache_classes = false
+
+ # Enabling caching of classes slows start-up time because all controllers
+ # are loaded at initalization, but it reduces memory and load because files
+ # are not reloaded with every request. For example, caching is not necessary
+ # for loading database migrations but useful for handling Knapsack specs.
+ config.cache_classes = ENV['CACHE_CLASSES'] == 'true'
# Configure static asset server for tests with Cache-Control for performance
config.assets.digest = false