spec/keys_spec.rb in fakeredis-0.2.2 vs spec/keys_spec.rb in fakeredis-0.3.0
- old
+ new
@@ -16,11 +16,10 @@
end
it "should determine if a key exists" do
@client.set("key1", "1")
-puts "checking existence"
@client.exists("key1").should == true
@client.exists("key2").should == false
end
it "should set a key's time to live in seconds" do
@@ -92,11 +91,13 @@
@client.keys("key:").should =~ ["key:a", "key:b", "key:c"]
end
it "should remove the expiration from a key" do
@client.set("key1", "1")
- @client.persist("key1")
+ @client.expireat("key1", Time.now.to_i)
+ @client.persist("key1").should == true
+ @client.persist("key1").should == false
@client.ttl("key1").should == -1
end
it "should return a random key from the keyspace" do
@@ -134,8 +135,16 @@
it "should determine the type stored at key" do
@client.set("key1", "1")
@client.type("key1").should == "string"
@client.type("key0").should == "none"
+ end
+
+ it "should convert the value into a string before storing" do
+ @client.set("key1", 1)
+ @client.get("key1").should == "1"
+
+ @client.setex("key2", 30, 1)
+ @client.get("key2").should == "1"
end
end
end