spec/hashes_spec.rb in fakeredis-0.3.1 vs spec/hashes_spec.rb in fakeredis-0.3.2
- old
+ new
@@ -92,9 +92,24 @@
@client.hmget("key1", "i1", "i2", "i3").should =~ ["val1", "val2", nil]
@client.hmget("key2", "i1", "i2").should == [nil, nil]
end
+ it "throws an argument error when you don't ask for any keys" do
+ lambda { @client.hmget("key1") }.should raise_error(ArgumentError)
+ end
+
+ it "should reject an empty list of values" do
+ lambda { @client.hmset("key") }.should raise_error(ArgumentError)
+ @client.exists("key").should be_false
+ end
+
+ it 'rejects an insert with a key but no value' do
+ lambda { @client.hmset("key", 'foo') }.should raise_error(ArgumentError)
+ lambda { @client.hmset("key", 'foo', 3, 'bar') }.should raise_error(ArgumentError)
+ @client.exists("key").should be_false
+ end
+
it "should set multiple hash fields to multiple values" do
@client.hmset("key", "k1", "value1", "k2", "value2")
@client.hget("key", "k1").should == "value1"
@client.hget("key", "k2").should == "value2"