summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/repository.rb10
-rw-r--r--db/fixtures/development/04_project.rb2
-rw-r--r--features/steps/dashboard/dashboard.rb4
-rw-r--r--features/steps/project/forked_merge_requests.rb4
-rw-r--r--features/steps/project/issues.rb4
-rw-r--r--features/steps/project/merge_requests.rb4
-rw-r--r--features/steps/project/snippets.rb4
-rw-r--r--features/steps/search.rb4
-rw-r--r--spec/mailers/notify_spec.rb9
-rw-r--r--spec/requests/api/repositories_spec.rb4
-rw-r--r--spec/support/test_env.rb19
11 files changed, 28 insertions, 40 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index ed220ae2e8d..082086d8e5a 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -250,20 +250,18 @@ class Repository
end
def contributors
- log = graph_log.group_by { |i| i[:author_email] }
+ commits = self.commits(nil, nil, 2000, 0, true)
- log.map do |email, contributions|
+ commits.group_by(&:author_email).map do |email, commits|
contributor = Gitlab::Contributor.new
contributor.email = email
- contributions.each do |contribution|
+ commits.each do |commit|
if contributor.name.blank?
- contributor.name = contribution[:author_name]
+ contributor.name = commit.author_name
end
contributor.commits += 1
- contributor.additions += contribution[:additions] || 0
- contributor.deletions += contribution[:deletions] || 0
end
contributor
diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/04_project.rb
index fef9666c6cb..ae4c0550a4f 100644
--- a/db/fixtures/development/04_project.rb
+++ b/db/fixtures/development/04_project.rb
@@ -7,7 +7,7 @@ Sidekiq::Testing.inline! do
'https://gitlab.com/gitlab-org/gitlab-ce.git',
'https://gitlab.com/gitlab-org/gitlab-ci.git',
'https://gitlab.com/gitlab-org/gitlab-shell.git',
- 'https://gitlab.com/gitlab-org/testme.git',
+ 'https://gitlab.com/gitlab-org/gitlab-test.git',
'https://github.com/twitter/flight.git',
'https://github.com/twitter/typeahead.js.git',
'https://github.com/h5bp/html5-boilerplate.git',
diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb
index 7fcca732626..1826ead1d51 100644
--- a/features/steps/dashboard/dashboard.rb
+++ b/features/steps/dashboard/dashboard.rb
@@ -82,8 +82,4 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
step 'I should see 1 project at group list' do
find('span.last_activity/span').should have_content('1')
end
-
- def project
- @project ||= Project.find_by(name: "Shop")
- end
end
diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb
index e8a6d635308..ccef84cdcc5 100644
--- a/features/steps/project/forked_merge_requests.rb
+++ b/features/steps/project/forked_merge_requests.rb
@@ -128,10 +128,6 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
page.should have_select("merge_request_target_project_id", selected: project.path_with_namespace)
end
- def project
- @project ||= Project.find_by!(name: "Shop")
- end
-
# Verify a link is generated against the correct project
def verify_commit_link(container_div, container_project)
# This should force a wait for the javascript to execute
diff --git a/features/steps/project/issues.rb b/features/steps/project/issues.rb
index 137eac33238..6d86c893044 100644
--- a/features/steps/project/issues.rb
+++ b/features/steps/project/issues.rb
@@ -236,8 +236,4 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
# make sure AJAX request finished
URI.parse(current_url).request_uri == project_issues_path(project, issue_search: text)
end
-
- def project
- @project ||= Project.find_by(name: 'Shop')
- end
end
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index cd8475c14ac..0cc78f0f58d 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -261,10 +261,6 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
end
- def project
- @project ||= Project.find_by!(name: "Shop")
- end
-
def merge_request
@merge_request ||= MergeRequest.find_by!(title: "Bug NS-05")
end
diff --git a/features/steps/project/snippets.rb b/features/steps/project/snippets.rb
index 2f8d3205d6c..4a39bfdbb79 100644
--- a/features/steps/project/snippets.rb
+++ b/features/steps/project/snippets.rb
@@ -89,10 +89,6 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
visit project_snippet_path(project, project_snippet)
end
- def project
- @project ||= Project.find_by!(name: "Shop")
- end
-
def project_snippet
@project_snippet ||= ProjectSnippet.find_by!(title: "Snippet one")
end
diff --git a/features/steps/search.rb b/features/steps/search.rb
index b1058989d0b..f3d8bd80f13 100644
--- a/features/steps/search.rb
+++ b/features/steps/search.rb
@@ -66,8 +66,4 @@ class Spinach::Features::Search < Spinach::FeatureSteps
step 'I should not see "Bar" link' do
page.should_not have_link "Bar"
end
-
- def project
- @project ||= Project.find_by(name: "Shop")
- end
end
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 799dce442cc..e06e8826e5c 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -44,7 +44,9 @@ describe Notify do
let(:example_site_path) { root_path }
let(:new_user) { create(:user, email: 'newguy@example.com', created_by_id: 1) }
- subject { Notify.new_user_email(new_user.id, new_user.password, 'kETLwRaayvigPq_x3SNM') }
+ token = 'kETLwRaayvigPq_x3SNM'
+
+ subject { Notify.new_user_email(new_user.id, new_user.password, token) }
it_behaves_like 'an email sent from GitLab'
@@ -65,7 +67,10 @@ describe Notify do
end
it 'includes a link for user to set password' do
- should have_body_text 'http://localhost/users/password/edit?reset_password_token=kETLwRaayvigPq_x3SNM'
+ params = "reset_password_token=#{token}"
+ should have_body_text(
+ %r{http://localhost(:\d+)?/users/password/edit\?#{params}}
+ )
end
it 'includes a link to the site' do
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb
index a339dbfe9db..6e54839b677 100644
--- a/spec/requests/api/repositories_spec.rb
+++ b/spec/requests/api/repositories_spec.rb
@@ -224,8 +224,8 @@ describe API::API, api: true do
contributor['email'].should == 'dmitriy.zaporozhets@gmail.com'
contributor['name'].should == 'Dmitriy Zaporozhets'
contributor['commits'].should == 13
- contributor['additions'].should == 4081
- contributor['deletions'].should == 29
+ contributor['additions'].should == 0
+ contributor['deletions'].should == 0
end
end
end
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 4b0a3856f89..5f55871dc4a 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -46,17 +46,16 @@ module TestEnv
end
def setup_factory_repo
- repo_path = repos_path + "/root/testme.git"
- clone_url = 'https://gitlab.com/gitlab-org/gitlab-test.git'
+ clone_url = "https://gitlab.com/gitlab-org/#{factory_repo_name}.git"
- unless File.directory?(repo_path)
- git_cmd = %W(git clone --bare #{clone_url} #{repo_path})
+ unless File.directory?(factory_repo_path)
+ git_cmd = %W(git clone --bare #{clone_url} #{factory_repo_path})
system(*git_cmd)
end
end
def copy_repo(project)
- base_repo_path = File.expand_path(repos_path + "/root/testme.git")
+ base_repo_path = File.expand_path(factory_repo_path)
target_repo_path = File.expand_path(repos_path + "/#{project.namespace.path}/#{project.path}.git")
FileUtils.mkdir_p(target_repo_path)
FileUtils.cp_r("#{base_repo_path}/.", target_repo_path)
@@ -66,4 +65,14 @@ module TestEnv
def repos_path
Gitlab.config.gitlab_shell.repos_path
end
+
+ private
+
+ def factory_repo_path
+ @factory_repo_path ||= repos_path + "/root/#{factory_repo_name}.git"
+ end
+
+ def factory_repo_name
+ 'gitlab-test'
+ end
end