spec/client_spec.rb in redis_failover-0.3.0 vs spec/client_spec.rb in redis_failover-0.4.0
- old
+ new
@@ -13,11 +13,11 @@
def fetch_nodes
{
:master => 'localhost:6379',
:slaves => ['localhost:1111'],
- :unreachable => []
+ :unavailable => []
}
end
end
describe Client do
@@ -55,11 +55,11 @@
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
+ it 'reconnects with redis failover server when node is unavailable' do
class << client
attr_reader :reconnected
def build_clients
@reconnected = true
super
@@ -68,28 +68,32 @@
def fetch_nodes
@calls ||= 0
{
:master => "localhost:222#{@calls += 1}",
:slaves => ['localhost:1111'],
- :unreachable => []
+ :unavailable => []
}
end
end
- client.current_master.make_unreachable!
+ client.current_master.make_unavailable!
client.del('foo')
client.reconnected.should be_true
end
- it 'fails hard when the failover server is unreachable' do
+ it 'fails hard when the failover server is unavailable' do
expect do
Client.new(:host => 'foo', :port => 123445)
- end.to raise_error(FailoverServerUnreachableError)
+ end.to raise_error(FailoverServerUnavailableError)
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
+
+ it 'raises error for unsupported operations' do
+ expect { client.select }.to raise_error(UnsupportedOperationError)
end
end
end
end