diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2156ca19c73b5b5a3d6d5064ddc1abb35e8c030d..4ea5ad1b401776786ec32f7a9471e4b8a295b6e6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -65,6 +65,7 @@ variables:
   ES_JAVA_OPTS: "-Xms256m -Xmx256m"
   ELASTIC_URL: "http://elastic:changeme@elasticsearch:9200"
   DOCKER_VERSION: "19.03.0"
+  CACHE_CLASSES: "true"
 
   # Preparing custom clone path to reduce space used by all random forks
   # on GitLab.com's Shared Runners. Our main forks - especially the security
diff --git a/config/environments/test.rb b/config/environments/test.rb
index f3a7f894b73525dd2a7ca0771f9f265c825a72b0..4e359cd308cee511250071c25211c76a06b38685 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -17,9 +17,7 @@
   # 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!
-
-  # Code doesn't change in CI so we don't need code-reloading
-  config.cache_classes = !!ENV['CI']
+  config.cache_classes = Gitlab::Utils.to_boolean(ENV['CACHE_CLASSES'], default: false)
 
   # Configure static asset server for tests with Cache-Control for performance
   config.assets.compile = false if ENV['CI']