Sha256: 78527b9a178707fe07de88948220c891b6a3b0fe24763b8ff9e85003d61df9e0

Contents?: true

Size: 744 Bytes

Versions: 12

Compression:

Stored size: 744 Bytes

Contents

require 'spec_helper'

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

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

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

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

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

  it "stores values as strings" do
    @redises.lpush(@key, 1)
    @redises.lindex(@key, 0).should == "1"
  end

  it_should_behave_like "a list-only command"
end

Version data entries

12 entries across 12 versions & 2 rubygems

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