spec/commands/renamenx_spec.rb in mock_redis-0.4.1 vs spec/commands/renamenx_spec.rb in mock_redis-0.5.0
- old
+ new
@@ -20,9 +20,16 @@
it "moves the data" do
@redises.renamenx(@key, @newkey)
@redises.get(@newkey).should == "oof"
end
+ it "raises an error when the source key is nonexistant" do
+ @redises.del(@key)
+ lambda do
+ @redises.rename(@key, @newkey)
+ end.should raise_error(Redis::CommandError)
+ end
+
it "raises an error when key == newkey" do
lambda do
@redises.renamenx(@key, @key)
end.should raise_error(RuntimeError)
end