+ #
+ it "should provide info" do
+ [:last_save_time, :redis_version, :total_connections_received, :connected_clients, :total_commands_processed, :connected_slaves, :uptime_in_seconds, :used_memory, :uptime_in_days, :changes_since_last_save].each do |x|
+ @r.info.keys.should include(x)
+ end
+ end
+ #
+ it "should be able to flush the database" do
+ @r['key1'] = 'keyone'
+ @r['key2'] = 'keytwo'
+ @r.keys('*').sort.should == ['foo', 'key1', 'key2'] #foo from before
+ @r.flush_db
+ @r.keys('*').should == []
+ end
+ #
+ it "should be able to provide the last save time" do
+ savetime = @r.last_save
+ Time.at(savetime).class.should == Time
+ Time.at(savetime).should <= Time.now
+ end
+
+ it "should be able to MGET keys" do
+ @r['foo'] = 1000
+ @r['bar'] = 2000
+ @r.mget('foo', 'bar').should == ['1000', '2000']
+ @r.mget('foo', 'bar', 'baz').should == ['1000', '2000', nil]
+ end
+
+ it "should bgsave" do
+ lambda {@r.bgsave}.should_not raise_error(RedisError)
+ end
+
+ it "should handle multiple servers" do
+ require 'dist_redis'
+ @r = DistRedis.new('localhost:6379', '127.0.0.1:6379')
+ @r.select_db(15) # use database 15 for testing so we dont accidentally step on you real data
+
+ 100.times do |idx|
+ @r[idx] = "foo#{idx}"
+ end
+
+ 100.times do |idx|
+ @r[idx].should == "foo#{idx}"
+ end
+ end
+
+ it "should be able to pipeline writes" do
+ @r.pipelined do |pipeline|
+ pipeline.push_head "list", "hello"
+ pipeline.push_head "list", 42
+ end
+
+ @r.type?('list').should == "list"
+ @r.list_length('list').should == 2
+ @r.pop_head('list').should == '42'
+ @r.delete('list')
+ end
+end