debian-mirror-gitlab/spec/support/redis.rb

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

29 lines
676 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
2022-10-11 01:57:18 +05:30
require 'gitlab/redis'
2020-03-13 15:44:24 +05:30
RSpec.configure do |config|
config.after(:each, :redis) do
Sidekiq.redis do |connection|
connection.redis.flushdb
end
end
2022-10-11 01:57:18 +05:30
Gitlab::Redis::ALL_CLASSES.each do |instance_class|
underscored_name = instance_class.store_name.underscore
2020-03-13 15:44:24 +05:30
2022-10-11 01:57:18 +05:30
config.around(:each, :"clean_gitlab_redis_#{underscored_name}") do |example|
public_send("redis_#{underscored_name}_cleanup!")
2020-03-13 15:44:24 +05:30
2022-10-11 01:57:18 +05:30
example.run
2021-09-04 01:27:46 +05:30
2022-10-11 01:57:18 +05:30
public_send("redis_#{underscored_name}_cleanup!")
end
2021-11-18 22:05:49 +05:30
end
2023-01-13 00:05:48 +05:30
config.before(:suite) do
Gitlab::Redis::ALL_CLASSES.each do |instance_class|
instance_class.with(&:flushdb)
end
end
2020-03-13 15:44:24 +05:30
end