Sha256: 8829824ff1b5518fcb4a08e5a930f0a7221a67a75942ae4818bb84c1d1e63e11

Contents?: true

Size: 803 Bytes

Versions: 31

Compression:

Stored size: 803 Bytes

Contents

require 'spec_helper'

describe "#rpushx(key, value)" do
  before { @key = 'mock-redis-test:92925' }

  it "returns the new size of the list" do
    @redises.lpush(@key, 'X')

    @redises.rpushx(@key, 'X').should == 2
    @redises.rpushx(@key, 'X').should == 3
  end

  it "does nothing when run against a nonexistent key" do
    @redises.rpushx(@key, 'value')
    @redises.get(@key).should be_nil
  end

  it "appends items to the list" do
    @redises.lpush(@key, "bert")
    @redises.rpushx(@key, "ernie")

    @redises.lindex(@key, 0).should == "bert"
    @redises.lindex(@key, 1).should == "ernie"
  end

  it "stores values as strings" do
    @redises.rpush(@key, 1)
    @redises.rpushx(@key, 2)
    @redises.lindex(@key, 1).should == "2"
  end

  it_should_behave_like "a list-only command"
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
mock_redis-0.10.0 spec/commands/rpushx_spec.rb
mock_redis-0.9.0 spec/commands/rpushx_spec.rb
mock_redis-0.8.2 spec/commands/rpushx_spec.rb
mock_redis-0.8.1 spec/commands/rpushx_spec.rb
mock_redis-0.8.0 spec/commands/rpushx_spec.rb
mock_redis-0.7.0 spec/commands/rpushx_spec.rb
mock_redis-0.6.6 spec/commands/rpushx_spec.rb
mock_redis-0.6.5 spec/commands/rpushx_spec.rb
mock_redis-0.6.4 spec/commands/rpushx_spec.rb
mock_redis-0.6.3 spec/commands/rpushx_spec.rb
mock_redis-0.6.2 spec/commands/rpushx_spec.rb
mock_redis-0.6.1 spec/commands/rpushx_spec.rb
mock_redis-0.6.0 spec/commands/rpushx_spec.rb
mock_redis-0.5.5 spec/commands/rpushx_spec.rb
mock_redis-0.5.4 spec/commands/rpushx_spec.rb
mock_redis-0.5.3 spec/commands/rpushx_spec.rb
mock_redis-0.5.2 spec/commands/rpushx_spec.rb
mock_redis-0.5.1 spec/commands/rpushx_spec.rb
mock_redis-0.5.0 spec/commands/rpushx_spec.rb
mock_redis-0.4.1 spec/commands/rpushx_spec.rb