Skip to content

Commit

Permalink
Merge branch 'bugfix-array-arguments-for-zadd'
Browse files Browse the repository at this point in the history
  • Loading branch information
caius committed Mar 7, 2013
2 parents b6e7a61 + 8b74e90 commit c3b7d4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/redis/connection/memory.rb
Expand Up @@ -726,7 +726,7 @@ def zadd(key, *args)
data_type_check(key, ZSet)
data[key] ||= ZSet.new

if args.size == 2
if args.size == 2 && !(Array === args.first)
score, value = args
exists = !data[key].key?(value.to_s)
data[key][value.to_s] = score
Expand Down
4 changes: 4 additions & 0 deletions spec/sorted_sets_spec.rb
Expand Up @@ -44,6 +44,10 @@ module FakeRedis
@client.zscore("key", "val2").should be == 2
@client.zscore("key", "val3").should be == 3
@client.zscore("key", "val4").should be == 4

@client.zadd("key", [[5, "val5"], [3, "val6"]]).should be == 2
@client.zscore("key", "val5").should be == 5
@client.zscore("key", "val6").should be == 3
end

it "should error with wrong number of arguments when adding members" do
Expand Down

0 comments on commit c3b7d4f

Please sign in to comment.