summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-03-27 17:14:01 -0400
committerRobert Speicher <rspeicher@gmail.com>2017-03-27 20:44:09 -0400
commitca9a79f62026aa63ab44665aa51a8e88de941b01 (patch)
tree5f98c43b79cdb30c60a75613f0f0e5f457a0e20c /spec/services
parentd4c99f644a2da2aa340aee8bc10c1dcf7c9e0d18 (diff)
downloadgitlab-ce-ca9a79f62026aa63ab44665aa51a8e88de941b01.tar.gz
Use `:empty_project` where possible in service specs
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/after_branch_delete_service_spec.rb2
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb2
-rw-r--r--spec/services/ci/create_trigger_request_service_spec.rb2
-rw-r--r--spec/services/ci/stop_environments_service_spec.rb2
-rw-r--r--spec/services/ci/update_build_queue_service_spec.rb2
-rw-r--r--spec/services/compare_service_spec.rb2
-rw-r--r--spec/services/create_release_service_spec.rb2
-rw-r--r--spec/services/delete_branch_service_spec.rb2
-rw-r--r--spec/services/delete_merged_branches_service_spec.rb2
-rw-r--r--spec/services/files/update_service_spec.rb2
-rw-r--r--spec/services/git_hooks_service_spec.rb4
-rw-r--r--spec/services/git_push_service_spec.rb4
-rw-r--r--spec/services/git_tag_push_service_spec.rb4
-rw-r--r--spec/services/groups/destroy_service_spec.rb2
-rw-r--r--spec/services/groups/update_service_spec.rb6
-rw-r--r--spec/services/issues/build_service_spec.rb2
-rw-r--r--spec/services/issues/move_service_spec.rb4
-rw-r--r--spec/services/issues/resolve_discussions_spec.rb2
-rw-r--r--spec/services/labels/find_or_create_service_spec.rb2
-rw-r--r--spec/services/labels/transfer_service_spec.rb4
-rw-r--r--spec/services/members/destroy_service_spec.rb2
-rw-r--r--spec/services/members/request_access_service_spec.rb6
-rw-r--r--spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb2
-rw-r--r--spec/services/merge_requests/assign_issues_service_spec.rb2
-rw-r--r--spec/services/merge_requests/build_service_spec.rb2
-rw-r--r--spec/services/merge_requests/create_service_spec.rb2
-rw-r--r--spec/services/merge_requests/get_urls_service_spec.rb2
-rw-r--r--spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb2
-rw-r--r--spec/services/merge_requests/refresh_service_spec.rb6
-rw-r--r--spec/services/merge_requests/resolve_service_spec.rb2
-rw-r--r--spec/services/merge_requests/update_service_spec.rb2
-rw-r--r--spec/services/milestones/close_service_spec.rb2
-rw-r--r--spec/services/notes/diff_position_update_service_spec.rb2
-rw-r--r--spec/services/notification_service_spec.rb12
-rw-r--r--spec/services/projects/destroy_service_spec.rb2
-rw-r--r--spec/services/projects/download_service_spec.rb4
-rw-r--r--spec/services/projects/fork_service_spec.rb15
-rw-r--r--spec/services/projects/housekeeping_service_spec.rb2
-rw-r--r--spec/services/projects/transfer_service_spec.rb6
-rw-r--r--spec/services/projects/update_pages_service_spec.rb6
-rw-r--r--spec/services/projects/update_service_spec.rb4
-rw-r--r--spec/services/projects/upload_service_spec.rb4
-rw-r--r--spec/services/search_service_spec.rb2
-rw-r--r--spec/services/slash_commands/interpret_service_spec.rb7
-rw-r--r--spec/services/spam_service_spec.rb2
-rw-r--r--spec/services/system_hooks_service_spec.rb14
-rw-r--r--spec/services/system_note_service_spec.rb33
-rw-r--r--spec/services/tags/create_service_spec.rb2
-rw-r--r--spec/services/tags/destroy_service_spec.rb2
-rw-r--r--spec/services/test_hook_service_spec.rb6
-rw-r--r--spec/services/todo_service_spec.rb39
-rw-r--r--spec/services/update_release_service_spec.rb2
-rw-r--r--spec/services/users/destroy_spec.rb4
-rw-r--r--spec/services/users/refresh_authorized_projects_service_spec.rb4
54 files changed, 142 insertions, 118 deletions
diff --git a/spec/services/after_branch_delete_service_spec.rb b/spec/services/after_branch_delete_service_spec.rb
index d29e0addb53..77ca17bc82c 100644
--- a/spec/services/after_branch_delete_service_spec.rb
+++ b/spec/services/after_branch_delete_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe AfterBranchDeleteService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:service) { described_class.new(project, user) }
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index a969829a63e..d2f0337c260 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Ci::CreatePipelineService, services: true do
- let(:project) { FactoryGirl.create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:admin) }
before do
diff --git a/spec/services/ci/create_trigger_request_service_spec.rb b/spec/services/ci/create_trigger_request_service_spec.rb
index 5e68343784d..5a20102872a 100644
--- a/spec/services/ci/create_trigger_request_service_spec.rb
+++ b/spec/services/ci/create_trigger_request_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Ci::CreateTriggerRequestService, services: true do
let(:service) { described_class.new }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:trigger) { create(:ci_trigger, project: project) }
before do
diff --git a/spec/services/ci/stop_environments_service_spec.rb b/spec/services/ci/stop_environments_service_spec.rb
index 560f83d94f7..32c72a9cf5e 100644
--- a/spec/services/ci/stop_environments_service_spec.rb
+++ b/spec/services/ci/stop_environments_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Ci::StopEnvironmentsService, services: true do
- let(:project) { create(:project, :private) }
+ let(:project) { create(:project, :private, :repository) }
let(:user) { create(:user) }
let(:service) { described_class.new(project, user) }
diff --git a/spec/services/ci/update_build_queue_service_spec.rb b/spec/services/ci/update_build_queue_service_spec.rb
index f01a388b895..c44e6b2a48b 100644
--- a/spec/services/ci/update_build_queue_service_spec.rb
+++ b/spec/services/ci/update_build_queue_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Ci::UpdateBuildQueueService, :services do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:build) { create(:ci_build, pipeline: pipeline) }
let(:pipeline) { create(:ci_pipeline, project: project) }
diff --git a/spec/services/compare_service_spec.rb b/spec/services/compare_service_spec.rb
index 0a7fc58523f..bea7c965233 100644
--- a/spec/services/compare_service_spec.rb
+++ b/spec/services/compare_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe CompareService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:service) { described_class.new(project, 'feature') }
diff --git a/spec/services/create_release_service_spec.rb b/spec/services/create_release_service_spec.rb
index 61e5ae72f51..271ccfe7968 100644
--- a/spec/services/create_release_service_spec.rb
+++ b/spec/services/create_release_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe CreateReleaseService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:tag_name) { project.repository.tag_names.first }
let(:description) { 'Awesome release!' }
diff --git a/spec/services/delete_branch_service_spec.rb b/spec/services/delete_branch_service_spec.rb
index 336f5dafb5b..c4685c9aa31 100644
--- a/spec/services/delete_branch_service_spec.rb
+++ b/spec/services/delete_branch_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe DeleteBranchService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
let(:user) { create(:user) }
let(:service) { described_class.new(project, user) }
diff --git a/spec/services/delete_merged_branches_service_spec.rb b/spec/services/delete_merged_branches_service_spec.rb
index 181488e89c7..a41a421fa6e 100644
--- a/spec/services/delete_merged_branches_service_spec.rb
+++ b/spec/services/delete_merged_branches_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe DeleteMergedBranchesService, services: true do
subject(:service) { described_class.new(project, project.owner) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
context '#execute' do
context 'unprotected branches' do
diff --git a/spec/services/files/update_service_spec.rb b/spec/services/files/update_service_spec.rb
index 35e6e139238..26aa5b432d4 100644
--- a/spec/services/files/update_service_spec.rb
+++ b/spec/services/files/update_service_spec.rb
@@ -3,7 +3,7 @@ require "spec_helper"
describe Files::UpdateService do
subject { described_class.new(project, user, commit_params) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:file_path) { 'files/ruby/popen.rb' }
let(:new_contents) { 'New Content' }
diff --git a/spec/services/git_hooks_service_spec.rb b/spec/services/git_hooks_service_spec.rb
index 3318dfb22b6..ac7ccfbaab0 100644
--- a/spec/services/git_hooks_service_spec.rb
+++ b/spec/services/git_hooks_service_spec.rb
@@ -3,8 +3,8 @@ require 'spec_helper'
describe GitHooksService, services: true do
include RepoHelpers
- let(:user) { create :user }
- let(:project) { create :project }
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :repository) }
let(:service) { GitHooksService.new }
before do
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index bd71618e6f4..0477cac6677 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -3,8 +3,8 @@ require 'spec_helper'
describe GitPushService, services: true do
include RepoHelpers
- let(:user) { create :user }
- let(:project) { create :project }
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :repository) }
before do
project.team << [user, :master]
diff --git a/spec/services/git_tag_push_service_spec.rb b/spec/services/git_tag_push_service_spec.rb
index bd074b9bd71..b73beb3f6fc 100644
--- a/spec/services/git_tag_push_service_spec.rb
+++ b/spec/services/git_tag_push_service_spec.rb
@@ -3,8 +3,8 @@ require 'spec_helper'
describe GitTagPushService, services: true do
include RepoHelpers
- let(:user) { create :user }
- let(:project) { create :project }
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :repository) }
let(:service) { GitTagPushService.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref) }
let(:oldrev) { Gitlab::Git::BLANK_SHA }
diff --git a/spec/services/groups/destroy_service_spec.rb b/spec/services/groups/destroy_service_spec.rb
index 98c560ffb26..2ee11fc8b4c 100644
--- a/spec/services/groups/destroy_service_spec.rb
+++ b/spec/services/groups/destroy_service_spec.rb
@@ -6,7 +6,7 @@ describe Groups::DestroyService, services: true do
let!(:user) { create(:user) }
let!(:group) { create(:group) }
let!(:nested_group) { create(:group, parent: group) }
- let!(:project) { create(:project, namespace: group) }
+ let!(:project) { create(:empty_project, namespace: group) }
let!(:gitlab_shell) { Gitlab::Shell.new }
let!(:remove_path) { group.path + "+#{group.id}+deleted" }
diff --git a/spec/services/groups/update_service_spec.rb b/spec/services/groups/update_service_spec.rb
index 7c0fccb9d41..91ec224d1c4 100644
--- a/spec/services/groups/update_service_spec.rb
+++ b/spec/services/groups/update_service_spec.rb
@@ -13,7 +13,7 @@ describe Groups::UpdateService, services: true do
before do
public_group.add_user(user, Gitlab::Access::MASTER)
- create(:project, :public, group: public_group)
+ create(:empty_project, :public, group: public_group)
end
it "does not change permission level" do
@@ -27,7 +27,7 @@ describe Groups::UpdateService, services: true do
before do
internal_group.add_user(user, Gitlab::Access::MASTER)
- create(:project, :internal, group: internal_group)
+ create(:empty_project, :internal, group: internal_group)
end
it "does not change permission level" do
@@ -55,7 +55,7 @@ describe Groups::UpdateService, services: true do
before do
internal_group.add_user(user, Gitlab::Access::MASTER)
- create(:project, :internal, group: internal_group)
+ create(:empty_project, :internal, group: internal_group)
end
it 'returns true' do
diff --git a/spec/services/issues/build_service_spec.rb b/spec/services/issues/build_service_spec.rb
index 1dd53236fbd..17990f41b3b 100644
--- a/spec/services/issues/build_service_spec.rb
+++ b/spec/services/issues/build_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper.rb'
describe Issues::BuildService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
before do
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb
index db196ed5751..9f8346d52bb 100644
--- a/spec/services/issues/move_service_spec.rb
+++ b/spec/services/issues/move_service_spec.rb
@@ -5,8 +5,8 @@ describe Issues::MoveService, services: true do
let(:author) { create(:user) }
let(:title) { 'Some issue' }
let(:description) { 'Some issue description' }
- let(:old_project) { create(:project) }
- let(:new_project) { create(:project) }
+ let(:old_project) { create(:empty_project) }
+ let(:new_project) { create(:empty_project) }
let(:milestone1) { create(:milestone, project_id: old_project.id, title: 'v9.0') }
let(:old_issue) do
diff --git a/spec/services/issues/resolve_discussions_spec.rb b/spec/services/issues/resolve_discussions_spec.rb
index 6cc738aec08..3a72f92383c 100644
--- a/spec/services/issues/resolve_discussions_spec.rb
+++ b/spec/services/issues/resolve_discussions_spec.rb
@@ -10,7 +10,7 @@ class DummyService < Issues::BaseService
end
describe DummyService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
before do
diff --git a/spec/services/labels/find_or_create_service_spec.rb b/spec/services/labels/find_or_create_service_spec.rb
index 7a9b34f9f96..de8f1827cce 100644
--- a/spec/services/labels/find_or_create_service_spec.rb
+++ b/spec/services/labels/find_or_create_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Labels::FindOrCreateService, services: true do
describe '#execute' do
let(:group) { create(:group) }
- let(:project) { create(:project, namespace: group) }
+ let(:project) { create(:empty_project, namespace: group) }
let(:params) do
{
diff --git a/spec/services/labels/transfer_service_spec.rb b/spec/services/labels/transfer_service_spec.rb
index 13654a0881c..11d5f1cad5e 100644
--- a/spec/services/labels/transfer_service_spec.rb
+++ b/spec/services/labels/transfer_service_spec.rb
@@ -6,8 +6,8 @@ describe Labels::TransferService, services: true do
let(:group_1) { create(:group) }
let(:group_2) { create(:group) }
let(:group_3) { create(:group) }
- let(:project_1) { create(:project, namespace: group_2) }
- let(:project_2) { create(:project, namespace: group_3) }
+ let(:project_1) { create(:empty_project, namespace: group_2) }
+ let(:project_2) { create(:empty_project, namespace: group_3) }
let(:group_label_1) { create(:group_label, group: group_1, name: 'Group Label 1') }
let(:group_label_2) { create(:group_label, group: group_1, name: 'Group Label 2') }
diff --git a/spec/services/members/destroy_service_spec.rb b/spec/services/members/destroy_service_spec.rb
index 574df6e0f42..41450c67d7e 100644
--- a/spec/services/members/destroy_service_spec.rb
+++ b/spec/services/members/destroy_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Members::DestroyService, services: true do
let(:user) { create(:user) }
let(:member_user) { create(:user) }
- let(:project) { create(:project, :public) }
+ let(:project) { create(:empty_project, :public) }
let(:group) { create(:group, :public) }
shared_examples 'a service raising ActiveRecord::RecordNotFound' do
diff --git a/spec/services/members/request_access_service_spec.rb b/spec/services/members/request_access_service_spec.rb
index 853c125dadb..814c17b9ad0 100644
--- a/spec/services/members/request_access_service_spec.rb
+++ b/spec/services/members/request_access_service_spec.rb
@@ -29,7 +29,7 @@ describe Members::RequestAccessService, services: true do
end
context 'when current user cannot request access to the project' do
- %i[project group].each do |source_type|
+ %i[empty_project group].each do |source_type|
it_behaves_like 'a service raising Gitlab::Access::AccessDeniedError' do
let(:source) { create(source_type, :private) }
end
@@ -37,7 +37,7 @@ describe Members::RequestAccessService, services: true do
end
context 'when access requests are disabled' do
- %i[project group].each do |source_type|
+ %i[empty_project group].each do |source_type|
it_behaves_like 'a service raising Gitlab::Access::AccessDeniedError' do
let(:source) { create(source_type, :public) }
end
@@ -45,7 +45,7 @@ describe Members::RequestAccessService, services: true do
end
context 'when current user can request access to the project' do
- %i[project group].each do |source_type|
+ %i[empty_project group].each do |source_type|
it_behaves_like 'a service creating a access request' do
let(:source) { create(source_type, :public, :access_requestable) }
end
diff --git a/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb b/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb
index d80fb8a1af1..af0a214c00f 100644
--- a/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb
+++ b/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe MergeRequests::AddTodoWhenBuildFailsService do
let(:user) { create(:user) }
let(:merge_request) { create(:merge_request) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:sha) { '1234567890abcdef1234567890abcdef12345678' }
let(:ref) { merge_request.source_branch }
diff --git a/spec/services/merge_requests/assign_issues_service_spec.rb b/spec/services/merge_requests/assign_issues_service_spec.rb
index 5034b6ef33f..fe75757dd29 100644
--- a/spec/services/merge_requests/assign_issues_service_spec.rb
+++ b/spec/services/merge_requests/assign_issues_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe MergeRequests::AssignIssuesService, services: true do
let(:user) { create(:user) }
- let(:project) { create(:project, :public) }
+ let(:project) { create(:project, :public, :repository) }
let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project, author: user, description: "fixes #{issue.to_reference}") }
let(:service) { described_class.new(project, user, merge_request: merge_request) }
diff --git a/spec/services/merge_requests/build_service_spec.rb b/spec/services/merge_requests/build_service_spec.rb
index adfa75a524f..c8bd4d4601a 100644
--- a/spec/services/merge_requests/build_service_spec.rb
+++ b/spec/services/merge_requests/build_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe MergeRequests::BuildService, services: true do
include RepoHelpers
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:issue_confidential) { false }
let(:issue) { create(:issue, project: project, title: 'A bug', confidential: issue_confidential) }
diff --git a/spec/services/merge_requests/create_service_spec.rb b/spec/services/merge_requests/create_service_spec.rb
index 673c0bd6c9c..0e16c7cc94b 100644
--- a/spec/services/merge_requests/create_service_spec.rb
+++ b/spec/services/merge_requests/create_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe MergeRequests::CreateService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:assignee) { create(:user) }
diff --git a/spec/services/merge_requests/get_urls_service_spec.rb b/spec/services/merge_requests/get_urls_service_spec.rb
index b7a05907208..290e00ea1ba 100644
--- a/spec/services/merge_requests/get_urls_service_spec.rb
+++ b/spec/services/merge_requests/get_urls_service_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
describe MergeRequests::GetUrlsService do
- let(:project) { create(:project, :public) }
+ let(:project) { create(:project, :public, :repository) }
let(:service) { MergeRequests::GetUrlsService.new(project) }
let(:source_branch) { "my_branch" }
let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=#{source_branch}" }
diff --git a/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb b/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb
index c2f205c389d..769b3193275 100644
--- a/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb
+++ b/spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe MergeRequests::MergeWhenPipelineSucceedsService do
let(:user) { create(:user) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:mr_merge_if_green_enabled) do
create(:merge_request, merge_when_pipeline_succeeds: true, merge_user: user,
diff --git a/spec/services/merge_requests/refresh_service_spec.rb b/spec/services/merge_requests/refresh_service_spec.rb
index 92729f68e5f..c22d145ca5d 100644
--- a/spec/services/merge_requests/refresh_service_spec.rb
+++ b/spec/services/merge_requests/refresh_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe MergeRequests::RefreshService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:service) { MergeRequests::RefreshService }
@@ -11,7 +11,7 @@ describe MergeRequests::RefreshService, services: true do
group = create(:group)
group.add_owner(@user)
- @project = create(:project, namespace: group)
+ @project = create(:project, :repository, namespace: group)
@fork_project = Projects::ForkService.new(@project, @user).execute
@merge_request = create(:merge_request,
source_project: @project,
@@ -252,7 +252,7 @@ describe MergeRequests::RefreshService, services: true do
context 'when the merge request is sourced from a different project' do
it 'creates a `MergeRequestsClosingIssues` record for each issue closed by a commit' do
- forked_project = create(:project)
+ forked_project = create(:project, :repository)
create(:forked_project_link, forked_to_project: forked_project, forked_from_project: @project)
merge_request = create(:merge_request,
diff --git a/spec/services/merge_requests/resolve_service_spec.rb b/spec/services/merge_requests/resolve_service_spec.rb
index d33535d22af..eaf7785e549 100644
--- a/spec/services/merge_requests/resolve_service_spec.rb
+++ b/spec/services/merge_requests/resolve_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe MergeRequests::ResolveService do
let(:user) { create(:user) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:fork_project) do
create(:forked_project_with_submodules) do |fork_project|
diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb
index 7d73c0ea5d0..ad3d767f193 100644
--- a/spec/services/merge_requests/update_service_spec.rb
+++ b/spec/services/merge_requests/update_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe MergeRequests::UpdateService, services: true do
include EmailHelpers
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
diff --git a/spec/services/milestones/close_service_spec.rb b/spec/services/milestones/close_service_spec.rb
index fe6a19e97ea..d581b94ff43 100644
--- a/spec/services/milestones/close_service_spec.rb
+++ b/spec/services/milestones/close_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Milestones::CloseService, services: true do
let(:user) { create(:user) }
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:milestone) { create(:milestone, title: "Milestone v1.2", project: project) }
before do
diff --git a/spec/services/notes/diff_position_update_service_spec.rb b/spec/services/notes/diff_position_update_service_spec.rb
index 110efb54fa0..d73ae51fbc3 100644
--- a/spec/services/notes/diff_position_update_service_spec.rb
+++ b/spec/services/notes/diff_position_update_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Notes::DiffPositionUpdateService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:create_commit) { project.commit("913c66a37b4a45b9769037c55c2d238bd0942d2e") }
let(:modify_commit) { project.commit("874797c3a73b60d2187ed6e2fcabd289ff75171e") }
let(:edit_commit) { project.commit("570e7b2abdd848b95f2f578043fc23bd6f6fd24d") }
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 229291f19e9..5c841843b40 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -372,7 +372,7 @@ describe NotificationService, services: true do
end
context 'commit note' do
- let(:project) { create(:project, :public) }
+ let(:project) { create(:project, :public, :repository) }
let(:note) { create(:note_on_commit, project: project) }
before do
@@ -421,7 +421,7 @@ describe NotificationService, services: true do
end
context "merge request diff note" do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:merge_request) { create(:merge_request, source_project: project, assignee: user) }
let(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request) }
@@ -849,7 +849,7 @@ describe NotificationService, services: true do
describe 'Merge Requests' do
let(:group) { create(:group) }
- let(:project) { create(:project, :public, namespace: group) }
+ let(:project) { create(:project, :public, :repository, namespace: group) }
let(:another_project) { create(:empty_project, :public, namespace: group) }
let(:merge_request) { create :merge_request, source_project: project, assignee: create(:user), description: 'cc @participant' }
@@ -1161,7 +1161,7 @@ describe NotificationService, services: true do
end
describe 'Projects' do
- let(:project) { create :project }
+ let(:project) { create(:empty_project) }
before do
build_team(project)
@@ -1206,7 +1206,7 @@ describe NotificationService, services: true do
describe 'ProjectMember' do
describe '#decline_group_invite' do
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:member) { create(:user) }
before(:each) do
@@ -1280,7 +1280,7 @@ describe NotificationService, services: true do
describe 'Pipelines' do
describe '#pipeline_finished' do
- let(:project) { create(:project, :public) }
+ let(:project) { create(:project, :public, :repository) }
let(:current_user) { create(:user) }
let(:u_member) { create(:user) }
let(:u_other) { create(:user) }
diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb
index 74bfba44dfd..b1e10f4562e 100644
--- a/spec/services/projects/destroy_service_spec.rb
+++ b/spec/services/projects/destroy_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::DestroyService, services: true do
let!(:user) { create(:user) }
- let!(:project) { create(:project, namespace: user.namespace) }
+ let!(:project) { create(:project, :repository, namespace: user.namespace) }
let!(:path) { project.repository.path_to_repo }
let!(:remove_path) { path.sub(/\.git\Z/, "+#{project.id}+deleted.git") }
let!(:async) { false } # execute or async_execute
diff --git a/spec/services/projects/download_service_spec.rb b/spec/services/projects/download_service_spec.rb
index 122a7cea2a1..33b267c069c 100644
--- a/spec/services/projects/download_service_spec.rb
+++ b/spec/services/projects/download_service_spec.rb
@@ -3,8 +3,8 @@ require 'spec_helper'
describe Projects::DownloadService, services: true do
describe 'File service' do
before do
- @user = create :user
- @project = create :project, creator_id: @user.id, namespace: @user.namespace
+ @user = create(:user)
+ @project = create(:empty_project, creator_id: @user.id, namespace: @user.namespace)
end
context 'for a URL that is not on whitelist' do
diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb
index e3be1989c93..f8eb34f2ef4 100644
--- a/spec/services/projects/fork_service_spec.rb
+++ b/spec/services/projects/fork_service_spec.rb
@@ -7,6 +7,7 @@ describe Projects::ForkService, services: true do
@from_user = create(:user, namespace: @from_namespace )
avatar = fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")
@from_project = create(:project,
+ :repository,
creator_id: @from_user.id,
namespace: @from_namespace,
star_count: 107,
@@ -54,7 +55,7 @@ describe Projects::ForkService, services: true do
context 'project already exists' do
it "fails due to validation, not transaction failure" do
- @existing_project = create(:project, creator_id: @to_user.id, name: @from_project.name, namespace: @to_namespace)
+ @existing_project = create(:project, :repository, creator_id: @to_user.id, name: @from_project.name, namespace: @to_namespace)
@to_project = fork_project(@from_project, @to_user)
expect(@existing_project).to be_persisted
@@ -104,9 +105,10 @@ describe Projects::ForkService, services: true do
before do
@group_owner = create(:user)
@developer = create(:user)
- @project = create(:project, creator_id: @group_owner.id,
- star_count: 777,
- description: 'Wow, such a cool project!')
+ @project = create(:project, :repository,
+ creator_id: @group_owner.id,
+ star_count: 777,
+ description: 'Wow, such a cool project!')
@group = create(:group)
@group.add_user(@group_owner, GroupMember::OWNER)
@group.add_user(@developer, GroupMember::DEVELOPER)
@@ -139,8 +141,9 @@ describe Projects::ForkService, services: true do
context 'project already exists in group' do
it 'fails due to validation, not transaction failure' do
- existing_project = create(:project, name: @project.name,
- namespace: @group)
+ existing_project = create(:project, :repository,
+ name: @project.name,
+ namespace: @group)
to_project = fork_project(@project, @group_owner, @opts)
expect(existing_project.persisted?).to be_truthy
expect(to_project.errors[:name]).to eq(['has already been taken'])
diff --git a/spec/services/projects/housekeeping_service_spec.rb b/spec/services/projects/housekeeping_service_spec.rb
index 57a5aa5cedc..eaf63457b32 100644
--- a/spec/services/projects/housekeeping_service_spec.rb
+++ b/spec/services/projects/housekeeping_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::HousekeepingService do
subject { Projects::HousekeepingService.new(project) }
- let(:project) { create :project }
+ let(:project) { create(:project, :repository) }
before do
project.reset_pushes_since_gc
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb
index 5c6fbea8d0e..f8187fefc14 100644
--- a/spec/services/projects/transfer_service_spec.rb
+++ b/spec/services/projects/transfer_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::TransferService, services: true do
let(:user) { create(:user) }
let(:group) { create(:group) }
- let(:project) { create(:project, namespace: user.namespace) }
+ let(:project) { create(:project, :repository, namespace: user.namespace) }
context 'namespace -> namespace' do
before do
@@ -58,7 +58,7 @@ describe Projects::TransferService, services: true do
before { internal_group.add_owner(user) }
context 'when namespace visibility level < project visibility level' do
- let(:public_project) { create(:project, :public, namespace: user.namespace) }
+ let(:public_project) { create(:project, :public, :repository, namespace: user.namespace) }
before { transfer_project(public_project, user, internal_group) }
@@ -66,7 +66,7 @@ describe Projects::TransferService, services: true do
end
context 'when namespace visibility level > project visibility level' do
- let(:private_project) { create(:project, :private, namespace: user.namespace) }
+ let(:private_project) { create(:project, :private, :repository, namespace: user.namespace) }
before { transfer_project(private_project, user, internal_group) }
diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb
index f75fdd9e03f..fc0a17296f3 100644
--- a/spec/services/projects/update_pages_service_spec.rb
+++ b/spec/services/projects/update_pages_service_spec.rb
@@ -1,9 +1,9 @@
require "spec_helper"
describe Projects::UpdatePagesService do
- let(:project) { create :project }
- let(:pipeline) { create :ci_pipeline, project: project, sha: project.commit('HEAD').sha }
- let(:build) { create :ci_build, pipeline: pipeline, ref: 'HEAD' }
+ let(:project) { create(:project, :repository) }
+ let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit('HEAD').sha) }
+ let(:build) { create(:ci_build, pipeline: pipeline, ref: 'HEAD') }
let(:invalid_file) { fixture_file_upload(Rails.root + 'spec/fixtures/dk.png') }
subject { described_class.new(project, build) }
diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb
index caa23962519..05b18fef061 100644
--- a/spec/services/projects/update_service_spec.rb
+++ b/spec/services/projects/update_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::UpdateService, services: true do
let(:user) { create(:user) }
let(:admin) { create(:admin) }
- let(:project) { create(:project, creator_id: user.id, namespace: user.namespace) }
+ let(:project) { create(:empty_project, creator_id: user.id, namespace: user.namespace) }
describe 'update_by_user' do
context 'when visibility_level is INTERNAL' do
@@ -56,7 +56,7 @@ describe Projects::UpdateService, services: true do
end
describe 'visibility_level' do
- let(:project) { create(:project, :internal) }
+ let(:project) { create(:empty_project, :internal) }
let(:forked_project) { create(:forked_project_with_submodules, :internal) }
before do
diff --git a/spec/services/projects/upload_service_spec.rb b/spec/services/projects/upload_service_spec.rb
index 150c8ccaef7..d2cefa46bfa 100644
--- a/spec/services/projects/upload_service_spec.rb
+++ b/spec/services/projects/upload_service_spec.rb
@@ -3,8 +3,8 @@ require 'spec_helper'
describe Projects::UploadService, services: true do
describe 'File service' do
before do
- @user = create :user
- @project = create :project, creator_id: @user.id, namespace: @user.namespace
+ @user = create(:user)
+ @project = create(:empty_project, creator_id: @user.id, namespace: @user.namespace)
end
context 'for valid gif file' do
diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb
index bed1031e40a..6ef5fa008aa 100644
--- a/spec/services/search_service_spec.rb
+++ b/spec/services/search_service_spec.rb
@@ -44,7 +44,7 @@ describe 'Search::GlobalService', services: true do
context 'nested group' do
let!(:nested_group) { create(:group, :nested) }
- let!(:project) { create(:project, namespace: nested_group) }
+ let!(:project) { create(:empty_project, namespace: nested_group) }
before { project.add_master(user) }
diff --git a/spec/services/slash_commands/interpret_service_spec.rb b/spec/services/slash_commands/interpret_service_spec.rb
index 52e8678cb9d..a63281f0eab 100644
--- a/spec/services/slash_commands/interpret_service_spec.rb
+++ b/spec/services/slash_commands/interpret_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe SlashCommands::InterpretService, services: true do
- let(:project) { create(:project, :public) }
+ let(:project) { create(:empty_project, :public) }
let(:developer) { create(:user) }
let(:issue) { create(:issue, project: project) }
let(:milestone) { create(:milestone, project: project, title: '9.10') }
@@ -260,6 +260,8 @@ describe SlashCommands::InterpretService, services: true do
end
shared_examples 'merge command' do
+ let(:project) { create(:project, :repository) }
+
it 'runs merge command if content contains /merge' do
_, updates = service.execute(content, issuable)
@@ -322,6 +324,7 @@ describe SlashCommands::InterpretService, services: true do
end
context 'when sha is missing' do
+ let(:project) { create(:project, :repository) }
let(:service) { described_class.new(project, developer, {}) }
it 'precheck passes and returns merge command' do
@@ -694,7 +697,7 @@ describe SlashCommands::InterpretService, services: true do
end
context '/target_branch command' do
- let(:non_empty_project) { create(:project) }
+ let(:non_empty_project) { create(:project, :repository) }
let(:another_merge_request) { create(:merge_request, author: developer, source_project: non_empty_project) }
let(:service) { described_class.new(non_empty_project, developer)}
diff --git a/spec/services/spam_service_spec.rb b/spec/services/spam_service_spec.rb
index e09c05ccf32..74cba8c014b 100644
--- a/spec/services/spam_service_spec.rb
+++ b/spec/services/spam_service_spec.rb
@@ -15,7 +15,7 @@ describe SpamService, services: true do
end
context 'when recaptcha was not verified' do
- let(:project) { create(:project, :public) }
+ let(:project) { create(:empty_project, :public) }
let(:issue) { create(:issue, project: project) }
let(:request) { double(:request, env: {}) }
diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb
index 11037a4917b..667059f230c 100644
--- a/spec/services/system_hooks_service_spec.rb
+++ b/spec/services/system_hooks_service_spec.rb
@@ -1,13 +1,13 @@
require 'spec_helper'
describe SystemHooksService, services: true do
- let(:user) { create :user }
- let(:project) { create :project }
- let(:project_member) { create :project_member }
- let(:key) { create(:key, user: user) }
- let(:deploy_key) { create(:key) }
- let(:group) { create(:group) }
- let(:group_member) { create(:group_member) }
+ let(:user) { create(:user) }
+ let(:project) { create(:empty_project) }
+ let(:project_member) { create(:project_member) }
+ let(:key) { create(:key, user: user) }
+ let(:deploy_key) { create(:key) }
+ let(:group) { create(:group) }
+ let(:group_member) { create(:group_member) }
context 'event data' do
it { expect(event_data(user, :create)).to include(:event_name, :name, :created_at, :updated_at, :email, :user_id, :username) }
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 36a17a3bf2e..d7bf4c39cc0 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe SystemNoteService, services: true do
include Gitlab::Routing.url_helpers
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:author) { create(:user) }
let(:noteable) { create(:issue, project: project) }
@@ -32,6 +32,7 @@ describe SystemNoteService, services: true do
describe '.add_commits' do
subject { described_class.add_commits(noteable, project, author, new_commits, old_commits, oldrev) }
+ let(:project) { create(:project, :repository) }
let(:noteable) { create(:merge_request, source_project: project) }
let(:new_commits) { noteable.commits }
let(:old_commits) { [] }
@@ -216,6 +217,7 @@ describe SystemNoteService, services: true do
end
describe '.merge_when_pipeline_succeeds' do
+ let(:project) { create(:project, :repository) }
let(:pipeline) { build(:ci_pipeline_without_jobs )}
let(:noteable) do
create(:merge_request, source_project: project, target_project: project)
@@ -226,11 +228,12 @@ describe SystemNoteService, services: true do
it_behaves_like 'a system note'
it "posts the 'merge when pipeline succeeds' system note" do
- expect(subject.note).to match /enabled an automatic merge when the pipeline for (\w+\/\w+@)?\h{40} succeeds/
+ expect(subject.note).to match(/enabled an automatic merge when the pipeline for (\w+\/\w+@)?\h{40} succeeds/)
end
end
describe '.cancel_merge_when_pipeline_succeeds' do
+ let(:project) { create(:project, :repository) }
let(:noteable) do
create(:merge_request, source_project: project, target_project: project)
end
@@ -273,6 +276,8 @@ describe SystemNoteService, services: true do
describe '.change_branch' do
subject { described_class.change_branch(noteable, project, author, 'target', old_branch, new_branch) }
+
+ let(:project) { create(:project, :repository) }
let(:old_branch) { 'old_branch'}
let(:new_branch) { 'new_branch'}
@@ -288,6 +293,8 @@ describe SystemNoteService, services: true do
describe '.change_branch_presence' do
subject { described_class.change_branch_presence(noteable, project, author, :source, 'feature', :delete) }
+ let(:project) { create(:project, :repository) }
+
it_behaves_like 'a system note'
context 'when source branch deleted' do
@@ -300,11 +307,13 @@ describe SystemNoteService, services: true do
describe '.new_issue_branch' do
subject { described_class.new_issue_branch(noteable, project, author, "1-mepmep") }
+ let(:project) { create(:project, :repository) }
+
it_behaves_like 'a system note'
context 'when a branch is created from the new branch button' do
it 'sets the note text' do
- expect(subject.note).to match /\Acreated branch [`1-mepmep`]/
+ expect(subject.note).to start_with("created branch [`1-mepmep`]")
end
end
end
@@ -333,7 +342,7 @@ describe SystemNoteService, services: true do
describe 'note_body' do
context 'cross-project' do
- let(:project2) { create(:project) }
+ let(:project2) { create(:project, :repository) }
let(:mentioner) { create(:issue, project: project2) }
context 'from Commit' do
@@ -353,6 +362,7 @@ describe SystemNoteService, services: true do
context 'within the same project' do
context 'from Commit' do
+ let(:project) { create(:project, :repository) }
let(:mentioner) { project.repository.commit }
it 'references the mentioning commit' do
@@ -394,6 +404,7 @@ describe SystemNoteService, services: true do
end
context 'when mentioner is a MergeRequest' do
+ let(:project) { create(:project, :repository) }
let(:mentioner) { create(:merge_request, :simple, source_project: project) }
let(:noteable) { project.commit }
@@ -421,6 +432,7 @@ describe SystemNoteService, services: true do
end
describe '.cross_reference_exists?' do
+ let(:project) { create(:project, :repository) }
let(:commit0) { project.commit }
let(:commit1) { project.commit('HEAD~2') }
@@ -513,7 +525,7 @@ describe SystemNoteService, services: true do
end
describe '.noteable_moved' do
- let(:new_project) { create(:project) }
+ let(:new_project) { create(:empty_project) }
let(:new_noteable) { create(:issue, project: new_project) }
subject do
@@ -542,7 +554,7 @@ describe SystemNoteService, services: true do
it_behaves_like 'cross project mentionable'
it 'notifies about noteable being moved to' do
- expect(subject.note).to match /moved to/
+ expect(subject.note).to match('moved to')
end
end
@@ -552,7 +564,7 @@ describe SystemNoteService, services: true do
it_behaves_like 'cross project mentionable'
it 'notifies about noteable being moved from' do
- expect(subject.note).to match /moved from/
+ expect(subject.note).to match('moved from')
end
end
@@ -574,13 +586,13 @@ describe SystemNoteService, services: true do
end
end
- include JiraServiceHelper
-
describe 'JIRA integration' do
+ include JiraServiceHelper
+
let(:project) { create(:jira_project) }
let(:author) { create(:user) }
let(:issue) { create(:issue, project: project) }
- let(:merge_request) { create(:merge_request, :simple, target_project: project, source_project: project) }
+ let(:merge_request) { create(:merge_request, :simple, target_project: project, source_project: project) }
let(:jira_issue) { ExternalIssue.new("JIRA-1", project)}
let(:jira_tracker) { project.jira_service }
let(:commit) { project.commit }
@@ -809,6 +821,7 @@ describe SystemNoteService, services: true do
end
describe '.add_merge_request_wip_from_commit' do
+ let(:project) { create(:project, :repository) }
let(:noteable) do
create(:merge_request, source_project: project, target_project: project)
end
diff --git a/spec/services/tags/create_service_spec.rb b/spec/services/tags/create_service_spec.rb
index 5478b8c9ec0..b9121b1de49 100644
--- a/spec/services/tags/create_service_spec.rb
+++ b/spec/services/tags/create_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Tags::CreateService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
let(:user) { create(:user) }
let(:service) { described_class.new(project, user) }
diff --git a/spec/services/tags/destroy_service_spec.rb b/spec/services/tags/destroy_service_spec.rb
index a388c93379a..28396fc3658 100644
--- a/spec/services/tags/destroy_service_spec.rb
+++ b/spec/services/tags/destroy_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Tags::DestroyService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
let(:user) { create(:user) }
let(:service) { described_class.new(project, user) }
diff --git a/spec/services/test_hook_service_spec.rb b/spec/services/test_hook_service_spec.rb
index 4f6dd8c6d3f..f99fd8434c2 100644
--- a/spec/services/test_hook_service_spec.rb
+++ b/spec/services/test_hook_service_spec.rb
@@ -1,9 +1,9 @@
require 'spec_helper'
describe TestHookService, services: true do
- let(:user) { create :user }
- let(:project) { create :project }
- let(:hook) { create :project_hook, project: project }
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :repository) }
+ let(:hook) { create(:project_hook, project: project) }
describe '#execute' do
it "executes successfully" do
diff --git a/spec/services/todo_service_spec.rb b/spec/services/todo_service_spec.rb
index 3645b73b039..f9e432bb216 100644
--- a/spec/services/todo_service_spec.rb
+++ b/spec/services/todo_service_spec.rb
@@ -8,7 +8,7 @@ describe TodoService, services: true do
let(:guest) { create(:user) }
let(:admin) { create(:admin) }
let(:john_doe) { create(:user) }
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:mentions) { 'FYI: ' + [author, assignee, john_doe, member, guest, non_member, admin].map(&:to_reference).join(' ') }
let(:directly_addressed) { [author, assignee, john_doe, member, guest, non_member, admin].map(&:to_reference).join(' ') }
let(:directly_addressed_and_mentioned) { member.to_reference + ", what do you think? cc: " + [guest, admin].map(&:to_reference).join(' ') }
@@ -99,9 +99,9 @@ describe TodoService, services: true do
end
context 'when a private group is mentioned' do
- let(:group) { create :group, :private }
- let(:project) { create :project, :private, group: group }
- let(:issue) { create :issue, author: author, project: project, description: group.to_reference }
+ let(:group) { create(:group, :private) }
+ let(:project) { create(:empty_project, :private, group: group) }
+ let(:issue) { create(:issue, author: author, project: project, description: group.to_reference) }
before do
group.add_owner(author)
@@ -422,22 +422,26 @@ describe TodoService, services: true do
should_create_todo(user: john_doe, target: confidential_issue, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_confidential_issue)
end
- it 'creates a todo for each valid mentioned user when leaving a note on commit' do
- service.new_note(note_on_commit, john_doe)
+ context 'on commit' do
+ let(:project) { create(:project, :repository) }
- should_create_todo(user: member, target_id: nil, target_type: 'Commit', commit_id: note_on_commit.commit_id, author: john_doe, action: Todo::MENTIONED, note: note_on_commit)
- should_create_todo(user: author, target_id: nil, target_type: 'Commit', commit_id: note_on_commit.commit_id, author: john_doe, action: Todo::MENTIONED, note: note_on_commit)
- should_create_todo(user: john_doe, target_id: nil, target_type: 'Commit', commit_id: note_on_commit.commit_id, author: john_doe, action: Todo::MENTIONED, note: note_on_commit)
- should_not_create_todo(user: non_member, target_id: nil, target_type: 'Commit', commit_id: note_on_commit.commit_id, author: john_doe, action: Todo::MENTIONED, note: note_on_commit)
- end
+ it 'creates a todo for each valid mentioned user when leaving a note on commit' do
+ service.new_note(note_on_commit, john_doe)
+
+ should_create_todo(user: member, target_id: nil, target_type: 'Commit', commit_id: note_on_commit.commit_id, author: john_doe, action: Todo::MENTIONED, note: note_on_commit)
+ should_create_todo(user: author, target_id: nil, target_type: 'Commit', commit_id: note_on_commit.commit_id, author: john_doe, action: Todo::MENTIONED, note: note_on_commit)
+ should_create_todo(user: john_doe, target_id: nil, target_type: 'Commit', commit_id: note_on_commit.commit_id, author: john_doe, action: Todo::MENTIONED, note: note_on_commit)
+ should_not_create_todo(user: non_member, target_id: nil, target_type: 'Commit', commit_id: note_on_commit.commit_id, author: john_doe, action: Todo::MENTIONED, note: note_on_commit)
+ end
- it 'creates a directly addressed todo for each valid mentioned user when leaving a note on commit' do
- service.new_note(addressed_note_on_commit, john_doe)
+ it 'creates a directly addressed todo for each valid mentioned user when leaving a note on commit' do
+ service.new_note(addressed_note_on_commit, john_doe)
- should_create_todo(user: member, target_id: nil, target_type: 'Commit', commit_id: addressed_note_on_commit.commit_id, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_commit)
- should_create_todo(user: author, target_id: nil, target_type: 'Commit', commit_id: addressed_note_on_commit.commit_id, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_commit)
- should_create_todo(user: john_doe, target_id: nil, target_type: 'Commit', commit_id: addressed_note_on_commit.commit_id, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_commit)
- should_not_create_todo(user: non_member, target_id: nil, target_type: 'Commit', commit_id: addressed_note_on_commit.commit_id, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_commit)
+ should_create_todo(user: member, target_id: nil, target_type: 'Commit', commit_id: addressed_note_on_commit.commit_id, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_commit)
+ should_create_todo(user: author, target_id: nil, target_type: 'Commit', commit_id: addressed_note_on_commit.commit_id, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_commit)
+ should_create_todo(user: john_doe, target_id: nil, target_type: 'Commit', commit_id: addressed_note_on_commit.commit_id, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_commit)
+ should_not_create_todo(user: non_member, target_id: nil, target_type: 'Commit', commit_id: addressed_note_on_commit.commit_id, author: john_doe, action: Todo::DIRECTLY_ADDRESSED, note: addressed_note_on_commit)
+ end
end
it 'does not create todo when leaving a note on snippet' do
@@ -720,6 +724,7 @@ describe TodoService, services: true do
end
describe '#new_note' do
+ let(:project) { create(:project, :repository) }
let(:mention) { john_doe.to_reference }
let(:diff_note_on_merge_request) { create(:diff_note_on_merge_request, project: project, noteable: mr_unassigned, author: author, note: "Hey #{mention}") }
let(:addressed_diff_note_on_merge_request) { create(:diff_note_on_merge_request, project: project, noteable: mr_unassigned, author: author, note: "#{mention}, hey!") }
diff --git a/spec/services/update_release_service_spec.rb b/spec/services/update_release_service_spec.rb
index bba211089a8..69ed8de9c31 100644
--- a/spec/services/update_release_service_spec.rb
+++ b/spec/services/update_release_service_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe UpdateReleaseService, services: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:tag_name) { project.repository.tag_names.first }
let(:description) { 'Awesome release!' }
diff --git a/spec/services/users/destroy_spec.rb b/spec/services/users/destroy_spec.rb
index 922e82445d0..9a28c03d968 100644
--- a/spec/services/users/destroy_spec.rb
+++ b/spec/services/users/destroy_spec.rb
@@ -5,7 +5,7 @@ describe Users::DestroyService, services: true do
let!(:user) { create(:user) }
let!(:admin) { create(:admin) }
let!(:namespace) { create(:namespace, owner: user) }
- let!(:project) { create(:project, namespace: namespace) }
+ let!(:project) { create(:empty_project, namespace: namespace) }
let(:service) { described_class.new(admin) }
context 'no options are given' do
@@ -25,7 +25,7 @@ describe Users::DestroyService, services: true do
end
context "a deleted user's issues" do
- let(:project) { create :project }
+ let(:project) { create(:project) }
before do
project.add_developer(user)
diff --git a/spec/services/users/refresh_authorized_projects_service_spec.rb b/spec/services/users/refresh_authorized_projects_service_spec.rb
index 08733d6dcf1..b19374ef1a2 100644
--- a/spec/services/users/refresh_authorized_projects_service_spec.rb
+++ b/spec/services/users/refresh_authorized_projects_service_spec.rb
@@ -152,7 +152,7 @@ describe Users::RefreshAuthorizedProjectsService do
context 'projects of groups the user is a member of' do
let(:group) { create(:group) }
- let!(:other_project) { create(:project, group: group) }
+ let!(:other_project) { create(:empty_project, group: group) }
before do
group.add_owner(user)
@@ -166,7 +166,7 @@ describe Users::RefreshAuthorizedProjectsService do
context 'projects of subgroups of groups the user is a member of' do
let(:group) { create(:group) }
let(:nested_group) { create(:group, parent: group) }
- let!(:other_project) { create(:project, group: nested_group) }
+ let!(:other_project) { create(:empty_project, group: nested_group) }
before do
group.add_master(user)