Sha256: 188bcc49da0c5aa4c37b62ee5c8f42d3ffa66554b343ef736b81c8ce7ca4c876

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe "redis zsets" do

  it "should compose correctly" do
    z = RedisSortedSet.new("set1")

    z << [ [2, "timothy"], [1, "alexander"], [3, "mchale"] ]
    z.to_a.should == %w( alexander timothy mchale )

    z.set 1, "cat", 0, "dog"
    z.delete "cat"
    z.to_a.should == %w( dog )
  end

  it "should delete correctly" do
    z = RedisSortedSet.new("set1")
    z << [ [2, "timothy"], [1, "alexander"], [3, "mchale"], [0, "dog"], [7, "cat"] ]
    z.delete_by_score 1, 3
    z.to_a.should == %w( dog cat )
  end

  it "should accept hashes" do
    z = RedisSortedSet.new("set1")
    z << { 2 => "c", 0 => "a", 1 => "b" }
    z.to_a.should == %w( a b c )
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blendris-1.2 spec/zset_spec.rb
blendris-1.1 spec/zset_spec.rb