Sha256: 278c39ec1449d9e70e1551a75deb4299513bb85c2ea95476b4151e15a539936e

Contents?: true

Size: 810 Bytes

Versions: 12

Compression:

Stored size: 810 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_should_behave_like "a set-only command"
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
mock_redis-0.4.1 spec/commands/srem_spec.rb
mock_redis-0.4.0 spec/commands/srem_spec.rb
mock_redis-0.3.0 spec/commands/srem_spec.rb
ryansch-mock_redis-0.3.0 spec/commands/srem_spec.rb
ryansch-mock_redis-0.2.0.2 spec/commands/srem_spec.rb
ryansch-mock_redis-0.2.0.1 spec/commands/srem_spec.rb
mock_redis-0.2.0 spec/commands/srem_spec.rb
mock_redis-0.1.2 spec/commands/srem_spec.rb
mock_redis-0.1.1 spec/commands/srem_spec.rb
mock_redis-0.1.0 spec/commands/srem_spec.rb
mock_redis-0.0.2 spec/commands/srem_spec.rb
mock_redis-0.0.1 spec/commands/srem_spec.rb