From 48e118a0549a60000b5400f8ef4b7be83bfaa75c Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 7 Apr 2016 15:43:33 +0800 Subject: [PATCH] DRY up tests. --- spec/components/discourse_redis_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/components/discourse_redis_spec.rb b/spec/components/discourse_redis_spec.rb index 6f0f1619b..fd0435828 100644 --- a/spec/components/discourse_redis_spec.rb +++ b/spec/components/discourse_redis_spec.rb @@ -83,8 +83,10 @@ describe DiscourseRedis do begin fallback_handler.master = false Redis::Client.any_instance.expects(:call).with([:info]).returns(DiscourseRedis::FallbackHandler::MASTER_LINK_STATUS) - Redis::Client.any_instance.expects(:call).with([:client, [:kill, 'type', 'normal']]) - Redis::Client.any_instance.expects(:call).with([:client, [:kill, 'type', 'pubsub']]) + + %w{normal pubsub}.each do |connection_type| + Redis::Client.any_instance.expects(:call).with([:client, [:kill, 'type', connection_type]]) + end fallback_handler.initiate_fallback_to_master