From b5bbb8ae8a8fd8c91085639378b969414266c487 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 2 Oct 2017 13:16:01 +0800 Subject: [PATCH] Fix failing spec. --- spec/components/discourse_redis_spec.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/components/discourse_redis_spec.rb b/spec/components/discourse_redis_spec.rb index 374ee3c1619..07742fce545 100644 --- a/spec/components/discourse_redis_spec.rb +++ b/spec/components/discourse_redis_spec.rb @@ -184,10 +184,13 @@ describe DiscourseRedis do it 'should fallback to the master server once it is up' do fallback_handler.master = false - Redis::Client.any_instance.expects(:call).with([:info]).returns(DiscourseRedis::FallbackHandler::MASTER_LINK_STATUS) + redis_connection = DiscourseRedis.raw_connection.client + Redis::Client.expects(:new).with(DiscourseRedis.slave_config).returns(redis_connection) + + redis_connection.expects(:call).with([:info]).returns(DiscourseRedis::FallbackHandler::MASTER_LINK_STATUS) DiscourseRedis::FallbackHandler::CONNECTION_TYPES.each do |connection_type| - Redis::Client.any_instance.expects(:call).with([:client, [:kill, 'type', connection_type]]) + redis_connection.expects(:call).with([:client, [:kill, 'type', connection_type]]) end expect(fallback_handler.initiate_fallback_to_master).to eq(true)