spec/strings_spec.rb in fakeredis-0.4.2 vs spec/strings_spec.rb in fakeredis-0.4.3
- old
+ new
@@ -156,9 +156,18 @@
@client.get("key1").should be == "value1"
@client.get("key2").should be == "value2"
end
+ it "should raise error if command arguments count is wrong" do
+ expect { @client.mset }.to raise_error(Redis::CommandError, "ERR wrong number of arguments for 'mset' command")
+ expect { @client.mset(:key1) }.to raise_error(Redis::CommandError, "ERR wrong number of arguments for 'mset' command")
+ expect { @client.mset(:key1, "value", :key2) }.to raise_error(Redis::CommandError, "ERR wrong number of arguments for MSET")
+
+ @client.get("key1").should be_nil
+ @client.get("key2").should be_nil
+ end
+
it "should set multiple keys to multiple values, only if none of the keys exist" do
@client.msetnx(:key1, "value1", :key2, "value2").should be == true
@client.msetnx(:key1, "value3", :key2, "value4").should be == false
@client.get("key1").should be == "value1"