Sha256: 5fec27158a8f862df9ada2acd024f6e4efda69ee82267a625ce1040e625e20c3
Contents?: true
Size: 916 Bytes
Versions: 20
Compression:
Stored size: 916 Bytes
Contents
require 'spec_helper' describe '#spop(key)' do before do @key = 'mock-redis-test:spop' @redises.sadd(@key, 'value') end it 'returns a member of the set' do @redises.spop(@key).should == 'value' end it 'removes a member of the set' do @redises.spop(@key) @redises.smembers(@key).should == [] end it 'returns nil if the set is empty' do @redises.spop(@key) @redises.spop(@key).should be_nil end it 'returns an array if count is not nil' do @redises.sadd(@key, 'value2') @redises.spop(@key, 2).should == %w[value value2] end it 'returns only whats in the set' do @redises.spop(@key, 2).should == ['value'] @redises.smembers(@key).should == [] end it 'returns an empty array if count is not nil and the set it empty' do @redises.spop(@key) @redises.spop(@key, 100).should == [] end it_should_behave_like 'a set-only command' end
Version data entries
20 entries across 20 versions & 1 rubygems