Sha256: 87dde25225d8a9ccc6178dda726acbb07eb155b2cc2ed1cd1a2a5b169a47344e

Contents?: true

Size: 1.06 KB

Versions: 37

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe '#smove(source, destination, member)' do
  before do
    @src  = 'mock-redis-test:smove-source'
    @dest = 'mock-redis-test:smove-destination'

    @redises.sadd(@src, 1)
    @redises.sadd(@dest, 2)
  end

  it "returns true if the member exists in src" do
    @redises.smove(@src, @dest, 1).should be_true
  end

  it "returns false if the member exists in src" do
    @redises.smove(@src, @dest, 'nope').should be_false
  end

  it "returns true if the member exists in src and dest" do
    @redises.sadd(@dest, 1)
    @redises.smove(@src, @dest, 1).should be_true
  end

  it "moves member from source to destination" do
    @redises.smove(@src, @dest, 1)
    @redises.sismember(@dest, 1).should be_true
    @redises.sismember(@src, 1).should be_false
  end

  it "cleans up empty sets" do
    @redises.smove(@src, @dest, 1)
    @redises.get(@src).should be_nil
  end

  it "treats a nonexistent value as an empty set" do
    @redises.smove('mock-redis-test:nonesuch', @dest, 1).should be_false
  end

  it_should_behave_like "a set-only command"
end

Version data entries

37 entries across 37 versions & 2 rubygems

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