Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a bug in remove_member that would remove all of the optional me…

…mber data
  • Loading branch information...
commit 5a1197dc7e939366930e6c0663935617d04cc572 1 parent e9c4e6b
@czarneckid czarneckid authored
View
4 CHANGELOG.markdown
@@ -1,5 +1,9 @@
# CHANGELOG
+## leaderboard 3.0.1 (2012-12-19)
+
+* Fixed a bug in `remove_member` that would remove all of the optional member data.
+
## leaderboard 3.0.0 (2012-12-03)
* Added `rank_member_if` and `rank_member_if_in` methods that allow you to rank a member in the leaderboard based on execution of a lambda.
View
2  lib/leaderboard.rb
@@ -255,7 +255,7 @@ def remove_member(member)
def remove_member_from(leaderboard_name, member)
@redis_connection.multi do |transaction|
transaction.zrem(leaderboard_name, member)
- transaction.del(member_data_key(leaderboard_name), member)
+ transaction.hdel(member_data_key(leaderboard_name), member)
end
end
View
2  lib/leaderboard/version.rb
@@ -1,4 +1,4 @@
class Leaderboard
# Leaderboard version
- VERSION = '3.0.0'.freeze
+ VERSION = '3.0.1'.freeze
end
View
12 spec/leaderboard_spec.rb
@@ -659,4 +659,16 @@
@leaderboard.rank_member_if(highscore_check, 'david', 1338)
@leaderboard.score_for('david').should eql(1338.0)
end
+
+ it 'should not delete all the member data when calling remove_member' do
+ rank_members_in_leaderboard
+
+ @redis_connection.exists("name:member_data").should be_true
+ @redis_connection.hgetall("name:member_data").size.should be(5)
+ @leaderboard.total_members.should be(5)
+ @leaderboard.remove_member('member_1')
+ @redis_connection.exists("name:member_data").should be_true
+ @redis_connection.hgetall("name:member_data").size.should be(4)
+ @leaderboard.total_members.should be(4)
+ end
end
View
2  spec/version_spec.rb
@@ -2,6 +2,6 @@
describe 'Leaderboard::VERSION' do
it 'should be the correct version' do
- Leaderboard::VERSION.should == '3.0.0'
+ Leaderboard::VERSION.should == '3.0.1'
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.