leaderboard_factory 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWQ3Mjc4ZDY5MzhkYWU4MTdmMWMxMzdhODUyNGIwMjcwNGY1MjAzOA==
5
+ data.tar.gz: !binary |-
6
+ N2RjZmUzOTg1ZTEzZjMwOWUyMjk0NmU3ODk5ZDI4MDMxZjQ4OGI1Mg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YzVjNDYxZjM5ZjlmN2ExM2ZlNDg5MzhlMWRhYzE1MDM2ZTMwMTM1OTdiMWE3
10
+ YmI4ZjBkOTFjYzY3NTZiZjc4MGNhZThlZGMwY2RkYzAzMDdkOGI0Mjg2MGIw
11
+ MjIxYzk0OGIzZjhjODhjMmEzZmE1ZDI5NDFkOGI0YzcwMmI0NjQ=
12
+ data.tar.gz: !binary |-
13
+ ZDBjZDU0NDMzZTk5ZjRiOWI0YTFjZWY5NzE1Mzk3ZDM0MjBjMmNjY2NmYjdm
14
+ YTFjNTk0YmFhNTRhZGNhMDhjZmQ1MzUxMzNmODE4NTMzMGFiMWQ5ZmExMzY0
15
+ NjUzYmY1YWJlYjVlOTU4M2U5NzFjN2M4ZGM0ZjlmZjM1ODEwNDQ=
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ *.rdb
3
4
  .bundle
4
5
  .config
5
6
  .yardoc
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ leaderboard_factory_gem
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p392
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Matt Wilson
1
+ Copyright (c) 2012-2013 Matt Wilson
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -78,4 +78,4 @@ There is a nascent and evolving set of helpers that you can access via `Player.l
78
78
 
79
79
  ## Copyright
80
80
 
81
- Copyright (c) 2012 Matt Wilson. See LICENSE for further details.
81
+ Copyright (c) 2012-2013 Matt Wilson. See LICENSE for further details.
@@ -1,3 +1,3 @@
1
1
  module LeaderboardFactory
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -32,6 +32,7 @@ describe LeaderboardFactory do
32
32
  options: {}
33
33
  })
34
34
  end
35
+
35
36
  it "creates a factory method that returns said leaderboard" do
36
37
  test_harness.class_eval do
37
38
  leaderboard 'fu_manchu', :id
@@ -40,6 +41,7 @@ describe LeaderboardFactory do
40
41
 
41
42
  instance.fu_manchu.should be_a_kind_of(Leaderboard)
42
43
  end
44
+
43
45
  it "uses the second parameter to namespace the leaderboard" do
44
46
  test_harness.class_eval do
45
47
  leaderboard 'fu_manchu', :id
@@ -49,6 +51,7 @@ describe LeaderboardFactory do
49
51
  leaderboard = instance.fu_manchu
50
52
  leaderboard.leaderboard_name.should == 'fu-manchu-haha'
51
53
  end
54
+
52
55
  it "doesn't leak the abstraction" do
53
56
  klass = Class.new do
54
57
  attr_accessor :id
@@ -59,6 +62,7 @@ describe LeaderboardFactory do
59
62
  klass.new.leaderboard_specs[:instance].keys.should include('garlic')
60
63
  test_harness.new.leaderboard_specs[:instance].should be_empty
61
64
  end
65
+
62
66
  it "is connected to the configured redis instance" do
63
67
  test_harness.class_eval do
64
68
  leaderboard 'fu_manchu', :id
@@ -66,6 +70,7 @@ describe LeaderboardFactory do
66
70
  redis = test_harness.new.fu_manchu.instance_variable_get(:@redis_connection)
67
71
  redis.should === LeaderboardFactory.redis
68
72
  end
73
+
69
74
  it "adds a convience accessor based on the singularized object name, e.g. maps_by_wins => rank_map_by_wins" do
70
75
  test_harness.class_eval do
71
76
  leaderboard 'maps_by_wins', :id
@@ -76,6 +81,7 @@ describe LeaderboardFactory do
76
81
  instance.rank_map_by_wins 'map', 3
77
82
  instance.maps_by_wins.all_members.should include({:member=>"map", :rank=>1, :score=>3.0})
78
83
  end
84
+
79
85
  describe "this convience accessor" do
80
86
  it "accepts an optional third parameter, which is member data" do
81
87
  test_harness.class_eval do
@@ -88,10 +94,11 @@ describe LeaderboardFactory do
88
94
  member: "map",
89
95
  rank: 1,
90
96
  score: 3.0,
91
- member_data: {"event_name"=>"framulator 5000"}
97
+ member_data: { event_name: "framulator 5000"}.to_s
92
98
  })
93
99
  end
94
100
  end
101
+
95
102
  it "can be overriden in the class" do
96
103
  klass = Class.new do
97
104
  attr_accessor :id
@@ -105,6 +112,7 @@ describe LeaderboardFactory do
105
112
 
106
113
  klass.new.rank_garlic_by_weight.should == "HA! HA!"
107
114
  end
115
+
108
116
  end
109
117
 
110
118
  describe ".collection_leaderboard" do
@@ -117,6 +125,7 @@ describe LeaderboardFactory do
117
125
  options: {}
118
126
  })
119
127
  end
128
+
120
129
  it "creates a factory method that returns said leaderboard" do
121
130
  test_harness.class_eval do
122
131
  collection_leaderboard 'greatest_of_all_time'
data/spec/spec_helper.rb CHANGED
@@ -5,5 +5,12 @@ LeaderboardFactory.redis = Redis.new(db: 15)
5
5
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
6
6
 
7
7
  RSpec.configure do |config|
8
+ config.before(:each) do
9
+ LeaderboardFactory.redis.flushdb
10
+ end
8
11
 
12
+ config.after(:all) do
13
+ LeaderboardFactory.redis.flushdb
14
+ LeaderboardFactory.redis.quit
15
+ end
9
16
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leaderboard_factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Matt Wilson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-03 00:00:00.000000000 Z
11
+ date: 2013-05-08 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: leaderboard
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activesupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -85,7 +76,8 @@ extra_rdoc_files: []
85
76
  files:
86
77
  - .gitignore
87
78
  - .rspec
88
- - .rvmrc
79
+ - .ruby-gemset
80
+ - .ruby-version
89
81
  - CHANGELOG.md
90
82
  - Gemfile
91
83
  - LICENSE
@@ -103,27 +95,26 @@ files:
103
95
  - spec/spec_helper.rb
104
96
  homepage: https://github.com/agoragames/leaderboard_factory
105
97
  licenses: []
98
+ metadata: {}
106
99
  post_install_message:
107
100
  rdoc_options: []
108
101
  require_paths:
109
102
  - lib
110
103
  required_ruby_version: !ruby/object:Gem::Requirement
111
- none: false
112
104
  requirements:
113
105
  - - ! '>='
114
106
  - !ruby/object:Gem::Version
115
107
  version: '0'
116
108
  required_rubygems_version: !ruby/object:Gem::Requirement
117
- none: false
118
109
  requirements:
119
110
  - - ! '>='
120
111
  - !ruby/object:Gem::Version
121
112
  version: '0'
122
113
  requirements: []
123
114
  rubyforge_project:
124
- rubygems_version: 1.8.24
115
+ rubygems_version: 2.0.3
125
116
  signing_key:
126
- specification_version: 3
117
+ specification_version: 4
127
118
  summary: Helps you define and work with a bunch of leaderboards, from, e.g. an ActiveModel
128
119
  object
129
120
  test_files:
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm --create 1.9.3@leaderboard_factory_gem