Sha256: 2e7a4e82b6fef9527622cdc1d06324493b7ac1254930436a9327de724f8c4b51

Contents?: true

Size: 958 Bytes

Versions: 14

Compression:

Stored size: 958 Bytes

Contents

require 'spec_helper'

describe '#srem(key, member)' do
  before do
    @key = 'mock-redis-test:srem'

    @redises.sadd(@key, 'bert')
    @redises.sadd(@key, 'ernie')
  end

  it 'returns true if member is in the set' do
    @redises.srem(@key, 'bert').should == true
  end

  it 'returns false if member is not in the set' do
    @redises.srem(@key, 'cookiemonster').should == false
  end

  it 'removes member from the set' do
    @redises.srem(@key, 'ernie')
    @redises.smembers(@key).should == ['bert']
  end

  it 'stringifies member' do
    @redises.sadd(@key, '1')
    @redises.srem(@key, 1).should == true
  end

  it 'cleans up empty sets' do
    @redises.smembers(@key).each { |m| @redises.srem(@key, m) }
    @redises.get(@key).should be_nil
  end

  it 'supports a variable number of arguments' do
    @redises.srem(@key, %w[bert ernie]).should == 2
    @redises.get(@key).should be_nil
  end

  it_should_behave_like 'a set-only command'
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mock_redis-0.20.0 spec/commands/srem_spec.rb
mock_redis-0.19.0 spec/commands/srem_spec.rb
mock_redis-0.18.0 spec/commands/srem_spec.rb
mock_redis-0.17.3 spec/commands/srem_spec.rb
mock_redis-0.17.2 spec/commands/srem_spec.rb
mock_redis-0.17.1 spec/commands/srem_spec.rb
mock_redis-0.17.0 spec/commands/srem_spec.rb
mock_redis-0.16.1 spec/commands/srem_spec.rb
mock_redis-0.16.0 spec/commands/srem_spec.rb
mock_redis-0.15.4 spec/commands/srem_spec.rb
mock_redis-0.15.3 spec/commands/srem_spec.rb
mock_redis-0.15.2 spec/commands/srem_spec.rb
mock_redis-0.15.1 spec/commands/srem_spec.rb
mock_redis-0.15.0 spec/commands/srem_spec.rb