spec/client_spec.rb in redis_failover-0.1.1 vs spec/client_spec.rb in redis_failover-0.2.0

- old
+ new

@@ -38,10 +38,11 @@ client.current_master.should_receive(:del) client.del('foo') end it 'routes read operations to a slave' do + client.current_slaves.first.change_role_to('slave') client.current_slaves.first.should_receive(:get) client.get('foo') end it 'reconnects with redis failover server when node is unreachable' do @@ -54,9 +55,20 @@ end client.current_master.make_unreachable! client.del('foo') client.reconnected.should be_true + end + + it 'fails hard when the failover server is unreachable' do + expect do + Client.new(:host => 'foo', :port => 123445) + end.to raise_error(FailoverServerUnreachableError) + end + + it 'properly detects when a node has changed roles' do + client.current_master.change_role_to('slave') + expect { client.send(:master) }.to raise_error(InvalidNodeRoleError) end end end end