Fix failing spec.

This commit is contained in:
Guo Xiang Tan 2017-10-02 13:16:01 +08:00
parent 0f2c5f5fc9
commit b5bbb8ae8a
1 changed files with 5 additions and 2 deletions

View File

@ -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)