Sha256: c130a623bf52d6f2e43a789928f1428872e632422d67ca7d2db47ebcddf003f8

Contents?: true

Size: 1.12 KB

Versions: 22

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

22 entries across 22 versions & 1 rubygems

Version Path
mock_redis-0.14.1 spec/commands/zcount_spec.rb
mock_redis-0.14.0 spec/commands/zcount_spec.rb
mock_redis-0.13.2 spec/commands/zcount_spec.rb
mock_redis-0.13.1 spec/commands/zcount_spec.rb
mock_redis-0.13.0 spec/commands/zcount_spec.rb
mock_redis-0.12.1 spec/commands/zcount_spec.rb
mock_redis-0.12.0 spec/commands/zcount_spec.rb
mock_redis-0.11.0 spec/commands/zcount_spec.rb
mock_redis-0.10.0 spec/commands/zcount_spec.rb
mock_redis-0.9.0 spec/commands/zcount_spec.rb
mock_redis-0.8.2 spec/commands/zcount_spec.rb
mock_redis-0.8.1 spec/commands/zcount_spec.rb
mock_redis-0.8.0 spec/commands/zcount_spec.rb
mock_redis-0.7.0 spec/commands/zcount_spec.rb
mock_redis-0.6.6 spec/commands/zcount_spec.rb
mock_redis-0.6.5 spec/commands/zcount_spec.rb
mock_redis-0.6.4 spec/commands/zcount_spec.rb
mock_redis-0.6.3 spec/commands/zcount_spec.rb
mock_redis-0.6.2 spec/commands/zcount_spec.rb
mock_redis-0.6.1 spec/commands/zcount_spec.rb