Skip to content

Commit

Permalink
Added feature test for stats
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaporozhets committed Nov 10, 2012
1 parent 1c5b2a5 commit 3e04673
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/views/repositories/stats.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
%br
%div#activity-chart
.span7
%h4 Top 100 Committers:
%h4 Top 50 Committers:
%ol.styled
- @stats.authors[0...100].each do |author|
- @stats.authors[0...50].each do |author|
%li
= image_tag gravatar_icon(author.email, 16), class: 'avatar s16'
= author.name
Expand Down
4 changes: 4 additions & 0 deletions features/project/commits/commits.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ Feature: Project Browse commits
Scenario: I browse commits for a specific path
Given I visit my project's commits page for a specific path
Then I see breadcrumb links

Scenario: I browse commits stats
Given I visit my project's commits stats page
Then I see commits stats
6 changes: 6 additions & 0 deletions features/steps/project/project_browse_commits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
find('ul.breadcrumb li:first a')['href'].should match(/#{@project.path}\/commits\/master\z/)
find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z})
end

Then 'I see commits stats' do
page.should have_content 'Stats for master'
page.should have_content 'Committers'
page.should have_content 'Total commits'
end
end
4 changes: 4 additions & 0 deletions features/steps/shared/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ module SharedPaths
visit project_commits_path(@project, @project.root_ref + "/app/models/project.rb", {limit: 5})
end

Given 'I visit my project\'s commits stats page' do
visit stats_project_repository_path(@project)
end

Given "I visit my project's network page" do
# Stub Graph::JsonBuilder max_size to speed up test (10 commits vs. 650)
Gitlab::Graph::JsonBuilder.stub(max_count: 10)
Expand Down
2 changes: 1 addition & 1 deletion lib/gitlab/git_stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def graph
protected

def collect_authors
shortlog = repo.git.shortlog({:e => true, :s => true }, ref)
shortlog = repo.git.shortlog({e: true, s: true }, ref)

authors = []

Expand Down

0 comments on commit 3e04673

Please sign in to comment.