Sha256: 700aa8978c5f93d4b0224d80c73b4793501c5a6d5f949c285c410a6eb4ab4a95

Contents?: true

Size: 959 Bytes

Versions: 25

Compression:

Stored size: 959 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 be_true
  end

  it "returns false if member is not in the set" do
    @redises.srem(@key, 'cookiemonster').should be_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 be_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, ['bert', 'ernie']).should == 2
    @redises.get(@key).should be_nil
  end

  it_should_behave_like "a set-only command"
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mock_redis-0.13.2 spec/commands/srem_spec.rb
mock_redis-0.13.1 spec/commands/srem_spec.rb
mock_redis-0.13.0 spec/commands/srem_spec.rb
mock_redis-0.12.1 spec/commands/srem_spec.rb
mock_redis-0.12.0 spec/commands/srem_spec.rb
mock_redis-0.11.0 spec/commands/srem_spec.rb
mock_redis-0.10.0 spec/commands/srem_spec.rb
mock_redis-0.9.0 spec/commands/srem_spec.rb
mock_redis-0.8.2 spec/commands/srem_spec.rb
mock_redis-0.8.1 spec/commands/srem_spec.rb
mock_redis-0.8.0 spec/commands/srem_spec.rb
mock_redis-0.7.0 spec/commands/srem_spec.rb
mock_redis-0.6.6 spec/commands/srem_spec.rb
mock_redis-0.6.5 spec/commands/srem_spec.rb
mock_redis-0.6.4 spec/commands/srem_spec.rb
mock_redis-0.6.3 spec/commands/srem_spec.rb
mock_redis-0.6.2 spec/commands/srem_spec.rb
mock_redis-0.6.1 spec/commands/srem_spec.rb
mock_redis-0.6.0 spec/commands/srem_spec.rb
mock_redis-0.5.5 spec/commands/srem_spec.rb