Permalink
Browse files

User#total_rubygems_count

This will be used to show the total number of pushed gems on the users profile.
  • Loading branch information...
1 parent d3c1879 commit e3cd26fe234c244d7cb4b713eff06547d4c8b5ba @MarkBennett MarkBennett committed Nov 4, 2012
Showing with 8 additions and 0 deletions.
  1. +4 −0 app/models/user.rb
  2. +4 −0 test/unit/user_test.rb
View
@@ -93,4 +93,8 @@ def today_downloads_count
def rubygems_downloaded
rubygems.sort_by{ |rubygem| -rubygem.downloads }
end
+
+ def total_rubygems_count
+ rubygems.count
+ end
end
View
@@ -208,6 +208,10 @@ class UserTest < ActiveSupport::TestCase
assert_equal @rubygems.values_at(2, 0, 1),
@user.rubygems_downloaded
end
+
+ should "total their number of pushed rubygems" do
+ assert_equal @user.total_rubygems_count, 3
+ end
end
context "yaml" do

0 comments on commit e3cd26f

Please sign in to comment.