2020-02-05 16:09:02 -05:00
|
|
|
# frozen_string_literal: true
|
2022-09-07 17:13:35 -04:00
|
|
|
require 'gitlab/redis'
|
2020-02-05 16:09:02 -05:00
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.after(:each, :redis) do
|
|
|
|
Sidekiq.redis do |connection|
|
|
|
|
connection.redis.flushdb
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-09-07 17:13:35 -04:00
|
|
|
Gitlab::Redis::ALL_CLASSES.each do |instance_class|
|
|
|
|
underscored_name = instance_class.store_name.underscore
|
2020-02-05 16:09:02 -05:00
|
|
|
|
2022-09-07 17:13:35 -04:00
|
|
|
config.around(:each, :"clean_gitlab_redis_#{underscored_name}") do |example|
|
|
|
|
public_send("redis_#{underscored_name}_cleanup!")
|
2020-02-05 16:09:02 -05:00
|
|
|
|
2022-09-07 17:13:35 -04:00
|
|
|
example.run
|
2021-06-10 11:10:14 -04:00
|
|
|
|
2022-09-07 17:13:35 -04:00
|
|
|
public_send("redis_#{underscored_name}_cleanup!")
|
|
|
|
end
|
2021-10-15 11:10:09 -04:00
|
|
|
end
|
2020-02-05 16:09:02 -05:00
|
|
|
end
|