Sha256: 6d744f48607accbfe37ff7a915779fe9c2772aeec7519911f6fff4d856a3e6c0
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe '#rename(key, newkey)' do before do @key = 'mock-redis-test:rename:key' @newkey = 'mock-redis-test:rename:newkey' @redises.set(@key, 'oof') end it "responds with 'OK'" do @redises.rename(@key, @newkey).should == 'OK' end it 'moves the data' do @redises.rename(@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.rename(@key, @key) end.should raise_error(RuntimeError) end it 'overwrites any existing value at newkey' do @redises.set(@newkey, 'rab') @redises.rename(@key, @newkey) @redises.get(@newkey).should == 'oof' end it 'keeps expiration' do @redises.expire(@key, 1000) @redises.rename(@key, @newkey) @redises.ttl(@newkey).should be > 0 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mock_redis-0.15.0 | spec/commands/rename_spec.rb |