Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
ca9a79f6
Commit
ca9a79f6
authored
Mar 27, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `:empty_project` where possible in service specs
parent
d4c99f64
Changes
55
Hide whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
143 additions
and
119 deletions
+143
-119
spec/services/after_branch_delete_service_spec.rb
spec/services/after_branch_delete_service_spec.rb
+1
-1
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+1
-1
spec/services/ci/create_trigger_request_service_spec.rb
spec/services/ci/create_trigger_request_service_spec.rb
+1
-1
spec/services/ci/stop_environments_service_spec.rb
spec/services/ci/stop_environments_service_spec.rb
+1
-1
spec/services/ci/update_build_queue_service_spec.rb
spec/services/ci/update_build_queue_service_spec.rb
+1
-1
spec/services/compare_service_spec.rb
spec/services/compare_service_spec.rb
+1
-1
spec/services/create_release_service_spec.rb
spec/services/create_release_service_spec.rb
+1
-1
spec/services/delete_branch_service_spec.rb
spec/services/delete_branch_service_spec.rb
+1
-1
spec/services/delete_merged_branches_service_spec.rb
spec/services/delete_merged_branches_service_spec.rb
+1
-1
spec/services/files/update_service_spec.rb
spec/services/files/update_service_spec.rb
+1
-1
spec/services/git_hooks_service_spec.rb
spec/services/git_hooks_service_spec.rb
+2
-2
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+2
-2
spec/services/git_tag_push_service_spec.rb
spec/services/git_tag_push_service_spec.rb
+2
-2
spec/services/groups/destroy_service_spec.rb
spec/services/groups/destroy_service_spec.rb
+1
-1
spec/services/groups/update_service_spec.rb
spec/services/groups/update_service_spec.rb
+3
-3
spec/services/issues/build_service_spec.rb
spec/services/issues/build_service_spec.rb
+1
-1
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+2
-2
spec/services/issues/resolve_discussions_spec.rb
spec/services/issues/resolve_discussions_spec.rb
+1
-1
spec/services/labels/find_or_create_service_spec.rb
spec/services/labels/find_or_create_service_spec.rb
+1
-1
spec/services/labels/transfer_service_spec.rb
spec/services/labels/transfer_service_spec.rb
+2
-2
spec/services/members/destroy_service_spec.rb
spec/services/members/destroy_service_spec.rb
+1
-1
spec/services/members/request_access_service_spec.rb
spec/services/members/request_access_service_spec.rb
+3
-3
spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb
.../merge_requests/add_todo_when_build_fails_service_spec.rb
+1
-1
spec/services/merge_requests/assign_issues_service_spec.rb
spec/services/merge_requests/assign_issues_service_spec.rb
+1
-1
spec/services/merge_requests/build_service_spec.rb
spec/services/merge_requests/build_service_spec.rb
+1
-1
spec/services/merge_requests/create_service_spec.rb
spec/services/merge_requests/create_service_spec.rb
+1
-1
spec/services/merge_requests/get_urls_service_spec.rb
spec/services/merge_requests/get_urls_service_spec.rb
+1
-1
spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb
...rge_requests/merge_when_pipeline_succeeds_service_spec.rb
+1
-1
spec/services/merge_requests/refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+3
-3
spec/services/merge_requests/resolve_service_spec.rb
spec/services/merge_requests/resolve_service_spec.rb
+1
-1
spec/services/merge_requests/update_service_spec.rb
spec/services/merge_requests/update_service_spec.rb
+1
-1
spec/services/milestones/close_service_spec.rb
spec/services/milestones/close_service_spec.rb
+1
-1
spec/services/notes/diff_position_update_service_spec.rb
spec/services/notes/diff_position_update_service_spec.rb
+1
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+6
-6
spec/services/projects/destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+1
-1
spec/services/projects/download_service_spec.rb
spec/services/projects/download_service_spec.rb
+2
-2
spec/services/projects/fork_service_spec.rb
spec/services/projects/fork_service_spec.rb
+9
-6
spec/services/projects/housekeeping_service_spec.rb
spec/services/projects/housekeeping_service_spec.rb
+1
-1
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+3
-3
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+3
-3
spec/services/projects/update_service_spec.rb
spec/services/projects/update_service_spec.rb
+2
-2
spec/services/projects/upload_service_spec.rb
spec/services/projects/upload_service_spec.rb
+2
-2
spec/services/search_service_spec.rb
spec/services/search_service_spec.rb
+1
-1
spec/services/slash_commands/interpret_service_spec.rb
spec/services/slash_commands/interpret_service_spec.rb
+5
-2
spec/services/spam_service_spec.rb
spec/services/spam_service_spec.rb
+1
-1
spec/services/system_hooks_service_spec.rb
spec/services/system_hooks_service_spec.rb
+7
-7
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+23
-10
spec/services/tags/create_service_spec.rb
spec/services/tags/create_service_spec.rb
+1
-1
spec/services/tags/destroy_service_spec.rb
spec/services/tags/destroy_service_spec.rb
+1
-1
spec/services/test_hook_service_spec.rb
spec/services/test_hook_service_spec.rb
+3
-3
spec/services/todo_service_spec.rb
spec/services/todo_service_spec.rb
+22
-17
spec/services/update_release_service_spec.rb
spec/services/update_release_service_spec.rb
+1
-1
spec/services/users/destroy_spec.rb
spec/services/users/destroy_spec.rb
+2
-2
spec/services/users/refresh_authorized_projects_service_spec.rb
...ervices/users/refresh_authorized_projects_service_spec.rb
+2
-2
spec/support/services/issuable_create_service_slash_commands_shared_examples.rb
...issuable_create_service_slash_commands_shared_examples.rb
+1
-1
No files found.
spec/services/after_branch_delete_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/ci/create_pipeline_service_spec.rb
View file @
ca9a79f6
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
...
...
spec/services/ci/create_trigger_request_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/ci/stop_environments_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/ci/update_build_queue_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/compare_service_spec.rb
View file @
ca9a79f6
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'
)
}
...
...
spec/services/create_release_service_spec.rb
View file @
ca9a79f6
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!'
}
...
...
spec/services/delete_branch_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/delete_merged_branches_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/files/update_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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'
}
...
...
spec/services/git_hooks_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/git_push_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
]
...
...
spec/services/git_tag_push_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
}
...
...
spec/services/groups/destroy_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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"
}
...
...
spec/services/groups/update_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/issues/build_service_spec.rb
View file @
ca9a79f6
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
...
...
spec/services/issues/move_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/issues/resolve_discussions_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/labels/find_or_create_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
{
...
...
spec/services/labels/transfer_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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'
)
}
...
...
spec/services/members/destroy_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/members/request_access_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
}
...
...
spec/services/merge_requests/assign_issues_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
)
}
...
...
spec/services/merge_requests/build_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
)
}
...
...
spec/services/merge_requests/create_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/merge_requests/get_urls_service_spec.rb
View file @
ca9a79f6
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
}
"
}
...
...
spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
,
...
...
spec/services/merge_requests/refresh_service_spec.rb
View file @
ca9a79f6
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
,
...
...
spec/services/merge_requests/resolve_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
|
...
...
spec/services/merge_requests/update_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
)
}
...
...
spec/services/milestones/close_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/notes/diff_position_update_service_spec.rb
View file @
ca9a79f6
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"
)
}
...
...
spec/services/notification_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
)
}
...
...
spec/services/projects/destroy_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/projects/download_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/projects/fork_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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'
])
...
...
spec/services/projects/housekeeping_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/projects/transfer_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
)
}
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/projects/update_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/projects/upload_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/search_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
)
}
...
...
spec/services/slash_commands/interpret_service_spec.rb
View file @
ca9a79f6
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
)}
...
...
spec/services/spam_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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:
{})
}
...
...
spec/services/system_hooks_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/system_note_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
...
...
spec/services/tags/create_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/tags/destroy_service_spec.rb
View file @
ca9a79f6
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
)
}
...
...
spec/services/test_hook_service_spec.rb
View file @
ca9a79f6
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
...
...
spec/services/todo_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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!"
)
}
...
...
spec/services/update_release_service_spec.rb
View file @
ca9a79f6
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!'
}
...
...
spec/services/users/destroy_spec.rb
View file @
ca9a79f6
...
...
@@ -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
)
...
...
spec/services/users/refresh_authorized_projects_service_spec.rb
View file @
ca9a79f6
...
...
@@ -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
)
...
...
spec/support/services/issuable_create_service_slash_commands_shared_examples.rb
View file @
ca9a79f6
...
...
@@ -2,7 +2,7 @@
# It can take a `default_params`.
shared_examples
'new issuable record that supports slash commands'
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
).
tap
{
|
u
|
project
.
team
<<
[
u
,
:master
]
}
}
let
(
:assignee
)
{
create
(
:user
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment