Skip to content

Commit

Permalink
User#total_rubygems_count
Browse files Browse the repository at this point in the history
This will be used to show the total number of pushed gems on the users profile.
  • Loading branch information
MarkBennett committed Nov 4, 2012
1 parent d3c1879 commit e3cd26f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/user.rb
Expand Up @@ -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
4 changes: 4 additions & 0 deletions test/unit/user_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit e3cd26f

Please sign in to comment.