Sha256: 1097d82f4dee07827895a1bf7d0951341632ed4ff9ae6f1b49edfe99c2df441e
Contents?: true
Size: 997 Bytes
Versions: 17
Compression:
Stored size: 997 Bytes
Contents
require 'spec_helper' describe '#setex(key, seconds, value)' do before { @key = 'mock-redis-test:setex' } it "responds with 'OK'" do @redises.setex(@key, 10, 'value').should == 'OK' end it 'sets the value' do @redises.setex(@key, 10_000, 'value') @redises.get(@key).should == 'value' end it 'sets the expiration time' do @redises.setex(@key, 10_000, 'value') # no guarantee these are the same @redises.real.ttl(@key).should > 0 @redises.mock.ttl(@key).should > 0 end context 'when expiration time is zero' do it 'raises Redis::CommandError' do expect do @redises.setex(@key, 0, 'value') end.to raise_error(Redis::CommandError, 'ERR invalid expire time in setex') end end context 'when expiration time is negative' do it 'raises Redis::CommandError' do expect do @redises.setex(@key, -2, 'value') end.to raise_error(Redis::CommandError, 'ERR invalid expire time in setex') end end end
Version data entries
17 entries across 17 versions & 1 rubygems