From 9308604549be2a36952c123a7bf24b9d4952fc1d Mon Sep 17 00:00:00 2001 From: Taico Aerts <t.v.aerts@tudelft.nl> Date: Fri, 9 Sep 2022 17:11:52 +0200 Subject: [PATCH] Properly use redis in tests --- config/environments/test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/environments/test.rb b/config/environments/test.rb index 479e7a7b1..46cdafe74 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/integer/time' +require 'namespaced_env_cache' # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that @@ -26,6 +27,14 @@ Rails.application.configure do config.consider_all_requests_local = true config.action_controller.perform_caching = false + processed = ERB.new(File.read(Rails.root.join('config', 'database.yml'))).result(binding) + redis_config = YAML.safe_load(processed, [], [], true)["redis_#{Rails.env}"] + config.cache_store = QPixel::NamespacedEnvCache.new( + ActiveSupport::Cache::RedisCacheStore.new( + url: "redis://#{redis_config['host']}:#{redis_config['port']}" + ) + ) + # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false -- GitLab