diff --git a/lib/mock_redis/zset.rb b/lib/mock_redis/zset.rb index 736e3a5..d18fbcf 100644 --- a/lib/mock_redis/zset.rb +++ b/lib/mock_redis/zset.rb @@ -23,12 +23,7 @@ def initialize_copy(source) def add(score, member) members.add(member) - scores[member] = - if score.to_f.to_i == score.to_f - score.to_f.to_i - else - score.to_f - end + scores[member] = score.to_f self end diff --git a/spec/commands/zadd_spec.rb b/spec/commands/zadd_spec.rb index a2afcc6..a3f3242 100644 --- a/spec/commands/zadd_spec.rb +++ b/spec/commands/zadd_spec.rb @@ -23,6 +23,12 @@ @redises.zrange(@key, 0, -1).should == [member.to_s] end + it 'allows scores to be set to Float::INFINITY' do + member = '1' + @redises.zadd(@key, Float::INFINITY, member) + @redises.zrange(@key, 0, -1).should == [member] + end + it 'updates the score' do @redises.zadd(@key, 1, 'foo') @redises.zadd(@key, 2, 'foo')