summaryrefslogtreecommitdiff
path: root/spec/support/caching.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-24 09:08:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-24 09:08:51 +0000
commit38149afcf95e7669a7a99828c579d185b70c04dc (patch)
tree3a90504bd926407c0cc60f44e20dba08217b928b /spec/support/caching.rb
parentbe660fe1d28a65ad61be24c71e66ae90f6488dc4 (diff)
downloadgitlab-ce-38149afcf95e7669a7a99828c579d185b70c04dc.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/caching.rb')
-rw-r--r--spec/support/caching.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/caching.rb b/spec/support/caching.rb
index ecbe65f7e97..883d531550a 100644
--- a/spec/support/caching.rb
+++ b/spec/support/caching.rb
@@ -21,6 +21,21 @@ RSpec.configure do |config|
ActionController::Base.cache_store = caching_store
end
+ config.around(:each, :use_clean_rails_redis_caching) do |example|
+ original_null_store = Rails.cache
+ caching_config_hash = Gitlab::Redis::Cache.params
+ caching_config_hash[:namespace] = Gitlab::Redis::Cache::CACHE_NAMESPACE
+ Rails.cache = ActiveSupport::Cache::RedisCacheStore.new(caching_config_hash)
+
+ redis_cache_cleanup!
+
+ example.run
+
+ redis_cache_cleanup!
+
+ Rails.cache = original_null_store
+ end
+
config.around(:each, :use_sql_query_cache) do |example|
ActiveRecord::Base.cache do
example.run