leaderboard 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## leaderboard 3.0.1 (2012-12-19)
4
+
5
+ * Fixed a bug in `remove_member` that would remove all of the optional member data.
6
+
3
7
  ## leaderboard 3.0.0 (2012-12-03)
4
8
 
5
9
  * 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.
@@ -255,7 +255,7 @@ class Leaderboard
255
255
  def remove_member_from(leaderboard_name, member)
256
256
  @redis_connection.multi do |transaction|
257
257
  transaction.zrem(leaderboard_name, member)
258
- transaction.del(member_data_key(leaderboard_name), member)
258
+ transaction.hdel(member_data_key(leaderboard_name), member)
259
259
  end
260
260
  end
261
261
 
@@ -1,4 +1,4 @@
1
1
  class Leaderboard
2
2
  # Leaderboard version
3
- VERSION = '3.0.0'.freeze
3
+ VERSION = '3.0.1'.freeze
4
4
  end
@@ -659,4 +659,16 @@ describe 'Leaderboard' do
659
659
  @leaderboard.rank_member_if(highscore_check, 'david', 1338)
660
660
  @leaderboard.score_for('david').should eql(1338.0)
661
661
  end
662
+
663
+ it 'should not delete all the member data when calling remove_member' do
664
+ rank_members_in_leaderboard
665
+
666
+ @redis_connection.exists("name:member_data").should be_true
667
+ @redis_connection.hgetall("name:member_data").size.should be(5)
668
+ @leaderboard.total_members.should be(5)
669
+ @leaderboard.remove_member('member_1')
670
+ @redis_connection.exists("name:member_data").should be_true
671
+ @redis_connection.hgetall("name:member_data").size.should be(4)
672
+ @leaderboard.total_members.should be(4)
673
+ end
662
674
  end
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe 'Leaderboard::VERSION' do
4
4
  it 'should be the correct version' do
5
- Leaderboard::VERSION.should == '3.0.0'
5
+ Leaderboard::VERSION.should == '3.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leaderboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-03 00:00:00.000000000 Z
12
+ date: 2012-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis