Sha256: ffe6215053b3454f17a5b39d331585b02fb9dba881eb12b1ea0f3bddeecd9d5a

Contents?: true

Size: 976 Bytes

Versions: 19

Compression:

Stored size: 976 Bytes

Contents

require 'spec_helper'

describe "#rpush(key)" do
  before { @key = "mock-redis-test:#{__FILE__}" }

  it "returns the new size of the list" do
    @redises.rpush(@key, 'X').should == 1
    @redises.rpush(@key, 'X').should == 2
  end

  it "creates a new list when run against a nonexistent key" do
    @redises.rpush(@key, 'value')
    @redises.llen(@key).should == 1
  end

  it "appends items to the list" do
    @redises.rpush(@key, "bert")
    @redises.rpush(@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.lindex(@key, 0).should == "1"
  end

  it "supports a variable number of arguments" do
    @redises.rpush(@key, [1, 2, 3]).should == 3
    @redises.lindex(@key, 0).should == "1"
    @redises.lindex(@key, 1).should == "2"
    @redises.lindex(@key, 2).should == "3"
  end

  it_should_behave_like "a list-only command"
end

Version data entries

19 entries across 19 versions & 1 rubygems

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