Commit 3e0467333471576735d225baec289c1e67e1a09c

Authored by randx
1 parent 1c5b2a51

Added feature test for stats

app/views/repositories/stats.html.haml
... ... @@ -16,9 +16,9 @@
16 16 %br
17 17 %div#activity-chart
18 18 .span7
19   - %h4 Top 100 Committers:
  19 + %h4 Top 50 Committers:
20 20 %ol.styled
21   - - @stats.authors[0...100].each do |author|
  21 + - @stats.authors[0...50].each do |author|
22 22 %li
23 23 = image_tag gravatar_icon(author.email, 16), class: 'avatar s16'
24 24 = author.name
... ...
features/project/commits/commits.feature
... ... @@ -23,3 +23,7 @@ Feature: Project Browse commits
23 23 Scenario: I browse commits for a specific path
24 24 Given I visit my project's commits page for a specific path
25 25 Then I see breadcrumb links
  26 +
  27 + Scenario: I browse commits stats
  28 + Given I visit my project's commits stats page
  29 + Then I see commits stats
... ...
features/steps/project/project_browse_commits.rb
... ... @@ -51,4 +51,10 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
51 51 find('ul.breadcrumb li:first a')['href'].should match(/#{@project.path}\/commits\/master\z/)
52 52 find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z})
53 53 end
  54 +
  55 + Then 'I see commits stats' do
  56 + page.should have_content 'Stats for master'
  57 + page.should have_content 'Committers'
  58 + page.should have_content 'Total commits'
  59 + end
54 60 end
... ...
features/steps/shared/paths.rb
... ... @@ -125,6 +125,10 @@ module SharedPaths
125 125 visit project_commits_path(@project, @project.root_ref + "/app/models/project.rb", {limit: 5})
126 126 end
127 127  
  128 + Given 'I visit my project\'s commits stats page' do
  129 + visit stats_project_repository_path(@project)
  130 + end
  131 +
128 132 Given "I visit my project's network page" do
129 133 # Stub Graph::JsonBuilder max_size to speed up test (10 commits vs. 650)
130 134 Gitlab::Graph::JsonBuilder.stub(max_count: 10)
... ...
lib/gitlab/git_stats.rb
... ... @@ -29,7 +29,7 @@ module Gitlab
29 29 protected
30 30  
31 31 def collect_authors
32   - shortlog = repo.git.shortlog({:e => true, :s => true }, ref)
  32 + shortlog = repo.git.shortlog({e: true, s: true }, ref)
33 33  
34 34 authors = []
35 35  
... ...