Sha256: a70c04909a3e6018a45588864724847fe9f9b578803f0506d0fe5ad191e339ba

Contents?: true

Size: 1.12 KB

Versions: 33

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe '#zcount(key, min, max)' do
  before do
    @key = 'mock-redis-test:zcount'
    @redises.zadd(@key, 1, 'Washington')
    @redises.zadd(@key, 2, 'Adams')
    @redises.zadd(@key, 3, 'Jefferson')
    @redises.zadd(@key, 4, 'Madison')
  end

  it 'returns the number of members in the zset with scores in (min..max)' do
    @redises.zcount(@key, 3, 10).should == 2
  end

  it 'returns 0 if there are no such members' do
    @redises.zcount(@key, 100, 200).should == 0
  end

  it 'returns count of all elements when -inf to +inf' do
    @redises.zcount(@key, '-inf', '+inf').should == 4
  end

  it 'returns a proper count of elements using +inf upper bound' do
    @redises.zcount(@key, 3, '+inf').should == 2
  end

  it 'returns a proper count of elements using exclusive lower bound' do
    @redises.zcount(@key, '(3', '+inf').should == 1
  end

  it 'returns a proper count of elements using exclusive upper bound' do
    @redises.zcount(@key, '-inf', '(3').should == 2
  end

  it_should_behave_like 'arg 1 is a score'
  it_should_behave_like 'arg 2 is a score'
  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/zcount_spec.rb
mock_redis-0.35.0 spec/commands/zcount_spec.rb
mock_redis-0.34.0 spec/commands/zcount_spec.rb
mock_redis-0.33.0 spec/commands/zcount_spec.rb
mock_redis-0.32.0 spec/commands/zcount_spec.rb
mock_redis-0.31.0 spec/commands/zcount_spec.rb
mock_redis-0.30.0 spec/commands/zcount_spec.rb
mock_redis-0.29.0 spec/commands/zcount_spec.rb
mock_redis-0.28.0 spec/commands/zcount_spec.rb
mock_redis-0.27.3 spec/commands/zcount_spec.rb
mock_redis-0.27.2 spec/commands/zcount_spec.rb
mock_redis-0.27.1 spec/commands/zcount_spec.rb
mock_redis-0.27.0 spec/commands/zcount_spec.rb
mock_redis-0.26.0 spec/commands/zcount_spec.rb
mock_redis-0.25.0 spec/commands/zcount_spec.rb
mock_redis-0.24.0 spec/commands/zcount_spec.rb
mock_redis-0.23.0 spec/commands/zcount_spec.rb
mock_redis-0.22.0 spec/commands/zcount_spec.rb
mock_redis-0.21.0 spec/commands/zcount_spec.rb
mock_redis-0.20.0 spec/commands/zcount_spec.rb