Sha256: 9488ecbfc5594a18c55e4a0fd33b6dd8766b646e668d11e9473284f3d84f2eb7

Contents?: true

Size: 718 Bytes

Versions: 33

Compression:

Stored size: 718 Bytes

Contents

require 'spec_helper'

describe '#zrank(key, member)' do
  before do
    @key = 'mock-redis-test:zrank'

    @redises.zadd(@key, 1, 'one')
    @redises.zadd(@key, 2, 'two')
    @redises.zadd(@key, 3, 'three')
  end

  it "returns nil if member wasn't present in the set" do
    @redises.zrank(@key, 'foo').should be_nil
  end

  it 'returns the index of the member in the set' do
    @redises.zrank(@key, 'one').should == 0
    @redises.zrank(@key, 'two').should == 1
    @redises.zrank(@key, 'three').should == 2
  end

  it 'handles integer members correctly' do
    member = 11
    @redises.zadd(@key, 4, member)
    @redises.zrank(@key, member).should == 3
  end

  it_should_behave_like 'a zset-only command'
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
mock_redis-0.36.0 spec/commands/zrank_spec.rb
mock_redis-0.35.0 spec/commands/zrank_spec.rb
mock_redis-0.34.0 spec/commands/zrank_spec.rb
mock_redis-0.33.0 spec/commands/zrank_spec.rb
mock_redis-0.32.0 spec/commands/zrank_spec.rb
mock_redis-0.31.0 spec/commands/zrank_spec.rb
mock_redis-0.30.0 spec/commands/zrank_spec.rb
mock_redis-0.29.0 spec/commands/zrank_spec.rb
mock_redis-0.28.0 spec/commands/zrank_spec.rb
mock_redis-0.27.3 spec/commands/zrank_spec.rb
mock_redis-0.27.2 spec/commands/zrank_spec.rb
mock_redis-0.27.1 spec/commands/zrank_spec.rb
mock_redis-0.27.0 spec/commands/zrank_spec.rb
mock_redis-0.26.0 spec/commands/zrank_spec.rb
mock_redis-0.25.0 spec/commands/zrank_spec.rb
mock_redis-0.24.0 spec/commands/zrank_spec.rb
mock_redis-0.23.0 spec/commands/zrank_spec.rb
mock_redis-0.22.0 spec/commands/zrank_spec.rb
mock_redis-0.21.0 spec/commands/zrank_spec.rb
mock_redis-0.20.0 spec/commands/zrank_spec.rb