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
Boxiang Sun
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'
require
'spec_helper'
describe
AfterBranchDeleteService
,
services:
true
do
describe
AfterBranchDeleteService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
...
...
spec/services/ci/create_pipeline_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
CreatePipelineService
,
services:
true
do
describe
Ci
::
CreatePipelineService
,
services:
true
do
let
(
:project
)
{
FactoryGirl
.
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:admin
)
}
before
do
before
do
...
...
spec/services/ci/create_trigger_request_service_spec.rb
View file @
ca9a79f6
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Ci
::
CreateTriggerRequestService
,
services:
true
do
describe
Ci
::
CreateTriggerRequestService
,
services:
true
do
let
(
:service
)
{
described_class
.
new
}
let
(
:service
)
{
described_class
.
new
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
)
}
let
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
)
}
before
do
before
do
...
...
spec/services/ci/stop_environments_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
StopEnvironmentsService
,
services:
true
do
describe
Ci
::
StopEnvironmentsService
,
services:
true
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:project
)
{
create
(
:project
,
:private
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
...
...
spec/services/ci/update_build_queue_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
UpdateBuildQueueService
,
:services
do
describe
Ci
::
UpdateBuildQueueService
,
:services
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
...
...
spec/services/compare_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
CompareService
,
services:
true
do
describe
CompareService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
'feature'
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
'feature'
)
}
...
...
spec/services/create_release_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
CreateReleaseService
,
services:
true
do
describe
CreateReleaseService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
first
}
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
first
}
let
(
:description
)
{
'Awesome release!'
}
let
(
:description
)
{
'Awesome release!'
}
...
...
spec/services/delete_branch_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
DeleteBranchService
,
services:
true
do
describe
DeleteBranchService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:repository
)
{
project
.
repository
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
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'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
DeleteMergedBranchesService
,
services:
true
do
describe
DeleteMergedBranchesService
,
services:
true
do
subject
(
:service
)
{
described_class
.
new
(
project
,
project
.
owner
)
}
subject
(
:service
)
{
described_class
.
new
(
project
,
project
.
owner
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
'#execute'
do
context
'#execute'
do
context
'unprotected branches'
do
context
'unprotected branches'
do
...
...
spec/services/files/update_service_spec.rb
View file @
ca9a79f6
...
@@ -3,7 +3,7 @@ require "spec_helper"
...
@@ -3,7 +3,7 @@ require "spec_helper"
describe
Files
::
UpdateService
do
describe
Files
::
UpdateService
do
subject
{
described_class
.
new
(
project
,
user
,
commit_params
)
}
subject
{
described_class
.
new
(
project
,
user
,
commit_params
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:file_path
)
{
'files/ruby/popen.rb'
}
let
(
:file_path
)
{
'files/ruby/popen.rb'
}
let
(
:new_contents
)
{
'New Content'
}
let
(
:new_contents
)
{
'New Content'
}
...
...
spec/services/git_hooks_service_spec.rb
View file @
ca9a79f6
...
@@ -3,8 +3,8 @@ require 'spec_helper'
...
@@ -3,8 +3,8 @@ require 'spec_helper'
describe
GitHooksService
,
services:
true
do
describe
GitHooksService
,
services:
true
do
include
RepoHelpers
include
RepoHelpers
let
(
:user
)
{
create
:user
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:service
)
{
GitHooksService
.
new
}
let
(
:service
)
{
GitHooksService
.
new
}
before
do
before
do
...
...
spec/services/git_push_service_spec.rb
View file @
ca9a79f6
...
@@ -3,8 +3,8 @@ require 'spec_helper'
...
@@ -3,8 +3,8 @@ require 'spec_helper'
describe
GitPushService
,
services:
true
do
describe
GitPushService
,
services:
true
do
include
RepoHelpers
include
RepoHelpers
let
(
:user
)
{
create
:user
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
...
...
spec/services/git_tag_push_service_spec.rb
View file @
ca9a79f6
...
@@ -3,8 +3,8 @@ require 'spec_helper'
...
@@ -3,8 +3,8 @@ require 'spec_helper'
describe
GitTagPushService
,
services:
true
do
describe
GitTagPushService
,
services:
true
do
include
RepoHelpers
include
RepoHelpers
let
(
:user
)
{
create
:user
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:service
)
{
GitTagPushService
.
new
(
project
,
user
,
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
)
}
let
(
:service
)
{
GitTagPushService
.
new
(
project
,
user
,
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
)
}
let
(
:oldrev
)
{
Gitlab
::
Git
::
BLANK_SHA
}
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
...
@@ -6,7 +6,7 @@ describe Groups::DestroyService, services: true do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:nested_group
)
{
create
(
:group
,
parent:
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!
(
:gitlab_shell
)
{
Gitlab
::
Shell
.
new
}
let!
(
:remove_path
)
{
group
.
path
+
"+
#{
group
.
id
}
+deleted"
}
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
...
@@ -13,7 +13,7 @@ describe Groups::UpdateService, services: true do
before
do
before
do
public_group
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
public_group
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
create
(
:project
,
:public
,
group:
public_group
)
create
(
:
empty_
project
,
:public
,
group:
public_group
)
end
end
it
"does not change permission level"
do
it
"does not change permission level"
do
...
@@ -27,7 +27,7 @@ describe Groups::UpdateService, services: true do
...
@@ -27,7 +27,7 @@ describe Groups::UpdateService, services: true do
before
do
before
do
internal_group
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
internal_group
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
create
(
:project
,
:internal
,
group:
internal_group
)
create
(
:
empty_
project
,
:internal
,
group:
internal_group
)
end
end
it
"does not change permission level"
do
it
"does not change permission level"
do
...
@@ -55,7 +55,7 @@ describe Groups::UpdateService, services: true do
...
@@ -55,7 +55,7 @@ describe Groups::UpdateService, services: true do
before
do
before
do
internal_group
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
internal_group
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
create
(
:project
,
:internal
,
group:
internal_group
)
create
(
:
empty_
project
,
:internal
,
group:
internal_group
)
end
end
it
'returns true'
do
it
'returns true'
do
...
...
spec/services/issues/build_service_spec.rb
View file @
ca9a79f6
require
'spec_helper.rb'
require
'spec_helper.rb'
describe
Issues
::
BuildService
,
services:
true
do
describe
Issues
::
BuildService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/services/issues/move_service_spec.rb
View file @
ca9a79f6
...
@@ -5,8 +5,8 @@ describe Issues::MoveService, services: true do
...
@@ -5,8 +5,8 @@ describe Issues::MoveService, services: true do
let
(
:author
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:title
)
{
'Some issue'
}
let
(
:title
)
{
'Some issue'
}
let
(
:description
)
{
'Some issue description'
}
let
(
:description
)
{
'Some issue description'
}
let
(
:old_project
)
{
create
(
:project
)
}
let
(
:old_project
)
{
create
(
:
empty_
project
)
}
let
(
:new_project
)
{
create
(
:project
)
}
let
(
:new_project
)
{
create
(
:
empty_
project
)
}
let
(
:milestone1
)
{
create
(
:milestone
,
project_id:
old_project
.
id
,
title:
'v9.0'
)
}
let
(
:milestone1
)
{
create
(
:milestone
,
project_id:
old_project
.
id
,
title:
'v9.0'
)
}
let
(
:old_issue
)
do
let
(
:old_issue
)
do
...
...
spec/services/issues/resolve_discussions_spec.rb
View file @
ca9a79f6
...
@@ -10,7 +10,7 @@ class DummyService < Issues::BaseService
...
@@ -10,7 +10,7 @@ class DummyService < Issues::BaseService
end
end
describe
DummyService
,
services:
true
do
describe
DummyService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/services/labels/find_or_create_service_spec.rb
View file @
ca9a79f6
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Labels
::
FindOrCreateService
,
services:
true
do
describe
Labels
::
FindOrCreateService
,
services:
true
do
describe
'#execute'
do
describe
'#execute'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
namespace:
group
)
}
let
(
:params
)
do
let
(
:params
)
do
{
{
...
...
spec/services/labels/transfer_service_spec.rb
View file @
ca9a79f6
...
@@ -6,8 +6,8 @@ describe Labels::TransferService, services: true do
...
@@ -6,8 +6,8 @@ describe Labels::TransferService, services: true do
let
(
:group_1
)
{
create
(
:group
)
}
let
(
:group_1
)
{
create
(
:group
)
}
let
(
:group_2
)
{
create
(
:group
)
}
let
(
:group_2
)
{
create
(
:group
)
}
let
(
:group_3
)
{
create
(
:group
)
}
let
(
:group_3
)
{
create
(
:group
)
}
let
(
:project_1
)
{
create
(
:project
,
namespace:
group_2
)
}
let
(
:project_1
)
{
create
(
:
empty_
project
,
namespace:
group_2
)
}
let
(
:project_2
)
{
create
(
:project
,
namespace:
group_3
)
}
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_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'
)
}
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'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Members
::
DestroyService
,
services:
true
do
describe
Members
::
DestroyService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:member_user
)
{
create
(
:user
)
}
let
(
:member_user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
shared_examples
'a service raising ActiveRecord::RecordNotFound'
do
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
...
@@ -29,7 +29,7 @@ describe Members::RequestAccessService, services: true do
end
end
context
'when current user cannot request access to the project'
do
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
it_behaves_like
'a service raising Gitlab::Access::AccessDeniedError'
do
let
(
:source
)
{
create
(
source_type
,
:private
)
}
let
(
:source
)
{
create
(
source_type
,
:private
)
}
end
end
...
@@ -37,7 +37,7 @@ describe Members::RequestAccessService, services: true do
...
@@ -37,7 +37,7 @@ describe Members::RequestAccessService, services: true do
end
end
context
'when access requests are disabled'
do
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
it_behaves_like
'a service raising Gitlab::Access::AccessDeniedError'
do
let
(
:source
)
{
create
(
source_type
,
:public
)
}
let
(
:source
)
{
create
(
source_type
,
:public
)
}
end
end
...
@@ -45,7 +45,7 @@ describe Members::RequestAccessService, services: true do
...
@@ -45,7 +45,7 @@ describe Members::RequestAccessService, services: true do
end
end
context
'when current user can request access to the project'
do
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
it_behaves_like
'a service creating a access request'
do
let
(
:source
)
{
create
(
source_type
,
:public
,
:access_requestable
)
}
let
(
:source
)
{
create
(
source_type
,
:public
,
:access_requestable
)
}
end
end
...
...
spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb
View file @
ca9a79f6
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
MergeRequests
::
AddTodoWhenBuildFailsService
do
describe
MergeRequests
::
AddTodoWhenBuildFailsService
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:sha
)
{
'1234567890abcdef1234567890abcdef12345678'
}
let
(
:sha
)
{
'1234567890abcdef1234567890abcdef12345678'
}
let
(
:ref
)
{
merge_request
.
source_branch
}
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'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
MergeRequests
::
AssignIssuesService
,
services:
true
do
describe
MergeRequests
::
AssignIssuesService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
,
author:
user
,
description:
"fixes
#{
issue
.
to_reference
}
"
)
}
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
)
}
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'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
MergeRequests
::
BuildService
,
services:
true
do
describe
MergeRequests
::
BuildService
,
services:
true
do
include
RepoHelpers
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:issue_confidential
)
{
false
}
let
(
:issue_confidential
)
{
false
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
title:
'A bug'
,
confidential:
issue_confidential
)
}
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'
require
'spec_helper'
describe
MergeRequests
::
CreateService
,
services:
true
do
describe
MergeRequests
::
CreateService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:assignee
)
{
create
(
:user
)
}
let
(
:assignee
)
{
create
(
:user
)
}
...
...
spec/services/merge_requests/get_urls_service_spec.rb
View file @
ca9a79f6
require
"spec_helper"
require
"spec_helper"
describe
MergeRequests
::
GetUrlsService
do
describe
MergeRequests
::
GetUrlsService
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:service
)
{
MergeRequests
::
GetUrlsService
.
new
(
project
)
}
let
(
:service
)
{
MergeRequests
::
GetUrlsService
.
new
(
project
)
}
let
(
:source_branch
)
{
"my_branch"
}
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
}
"
}
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'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
MergeRequests
::
MergeWhenPipelineSucceedsService
do
describe
MergeRequests
::
MergeWhenPipelineSucceedsService
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:mr_merge_if_green_enabled
)
do
let
(
:mr_merge_if_green_enabled
)
do
create
(
:merge_request
,
merge_when_pipeline_succeeds:
true
,
merge_user:
user
,
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'
require
'spec_helper'
describe
MergeRequests
::
RefreshService
,
services:
true
do
describe
MergeRequests
::
RefreshService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
MergeRequests
::
RefreshService
}
let
(
:service
)
{
MergeRequests
::
RefreshService
}
...
@@ -11,7 +11,7 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -11,7 +11,7 @@ describe MergeRequests::RefreshService, services: true do
group
=
create
(
:group
)
group
=
create
(
:group
)
group
.
add_owner
(
@user
)
group
.
add_owner
(
@user
)
@project
=
create
(
:project
,
namespace:
group
)
@project
=
create
(
:project
,
:repository
,
namespace:
group
)
@fork_project
=
Projects
::
ForkService
.
new
(
@project
,
@user
).
execute
@fork_project
=
Projects
::
ForkService
.
new
(
@project
,
@user
).
execute
@merge_request
=
create
(
:merge_request
,
@merge_request
=
create
(
:merge_request
,
source_project:
@project
,
source_project:
@project
,
...
@@ -252,7 +252,7 @@ describe MergeRequests::RefreshService, services: true do
...
@@ -252,7 +252,7 @@ describe MergeRequests::RefreshService, services: true do
context
'when the merge request is sourced from a different project'
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
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
)
create
(
:forked_project_link
,
forked_to_project:
forked_project
,
forked_from_project:
@project
)
merge_request
=
create
(
:merge_request
,
merge_request
=
create
(
:merge_request
,
...
...
spec/services/merge_requests/resolve_service_spec.rb
View file @
ca9a79f6
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
MergeRequests
::
ResolveService
do
describe
MergeRequests
::
ResolveService
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:fork_project
)
do
let
(
:fork_project
)
do
create
(
:forked_project_with_submodules
)
do
|
fork_project
|
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'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
MergeRequests
::
UpdateService
,
services:
true
do
describe
MergeRequests
::
UpdateService
,
services:
true
do
include
EmailHelpers
include
EmailHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
...
...
spec/services/milestones/close_service_spec.rb
View file @
ca9a79f6
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Milestones
::
CloseService
,
services:
true
do
describe
Milestones
::
CloseService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
title:
"Milestone v1.2"
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
title:
"Milestone v1.2"
,
project:
project
)
}
before
do
before
do
...
...
spec/services/notes/diff_position_update_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
Notes
::
DiffPositionUpdateService
,
services:
true
do
describe
Notes
::
DiffPositionUpdateService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:create_commit
)
{
project
.
commit
(
"913c66a37b4a45b9769037c55c2d238bd0942d2e"
)
}
let
(
:create_commit
)
{
project
.
commit
(
"913c66a37b4a45b9769037c55c2d238bd0942d2e"
)
}
let
(
:modify_commit
)
{
project
.
commit
(
"874797c3a73b60d2187ed6e2fcabd289ff75171e"
)
}
let
(
:modify_commit
)
{
project
.
commit
(
"874797c3a73b60d2187ed6e2fcabd289ff75171e"
)
}
let
(
:edit_commit
)
{
project
.
commit
(
"570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
)
}
let
(
:edit_commit
)
{
project
.
commit
(
"570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
)
}
...
...
spec/services/notification_service_spec.rb
View file @
ca9a79f6
...
@@ -372,7 +372,7 @@ describe NotificationService, services: true do
...
@@ -372,7 +372,7 @@ describe NotificationService, services: true do
end
end
context
'commit note'
do
context
'commit note'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:note
)
{
create
(
:note_on_commit
,
project:
project
)
}
let
(
:note
)
{
create
(
:note_on_commit
,
project:
project
)
}
before
do
before
do
...
@@ -421,7 +421,7 @@ describe NotificationService, services: true do
...
@@ -421,7 +421,7 @@ describe NotificationService, services: true do
end
end
context
"merge request diff note"
do
context
"merge request diff note"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
assignee:
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
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
...
@@ -849,7 +849,7 @@ describe NotificationService, services: true do
...
@@ -849,7 +849,7 @@ describe NotificationService, services: true do
describe
'Merge Requests'
do
describe
'Merge Requests'
do
let
(
:group
)
{
create
(
:group
)
}
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
(
:another_project
)
{
create
(
:empty_project
,
:public
,
namespace:
group
)
}
let
(
:merge_request
)
{
create
:merge_request
,
source_project:
project
,
assignee:
create
(
:user
),
description:
'cc @participant'
}
let
(
:merge_request
)
{
create
:merge_request
,
source_project:
project
,
assignee:
create
(
:user
),
description:
'cc @participant'
}
...
@@ -1161,7 +1161,7 @@ describe NotificationService, services: true do
...
@@ -1161,7 +1161,7 @@ describe NotificationService, services: true do
end
end
describe
'Projects'
do
describe
'Projects'
do
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:empty_project
)
}
before
do
before
do
build_team
(
project
)
build_team
(
project
)
...
@@ -1206,7 +1206,7 @@ describe NotificationService, services: true do
...
@@ -1206,7 +1206,7 @@ describe NotificationService, services: true do
describe
'ProjectMember'
do
describe
'ProjectMember'
do
describe
'#decline_group_invite'
do
describe
'#decline_group_invite'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:member
)
{
create
(
:user
)
}
let
(
:member
)
{
create
(
:user
)
}
before
(
:each
)
do
before
(
:each
)
do
...
@@ -1280,7 +1280,7 @@ describe NotificationService, services: true do
...
@@ -1280,7 +1280,7 @@ describe NotificationService, services: true do
describe
'Pipelines'
do
describe
'Pipelines'
do
describe
'#pipeline_finished'
do
describe
'#pipeline_finished'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:u_member
)
{
create
(
:user
)
}
let
(
:u_member
)
{
create
(
:user
)
}
let
(
:u_other
)
{
create
(
:user
)
}
let
(
:u_other
)
{
create
(
:user
)
}
...
...
spec/services/projects/destroy_service_spec.rb
View file @
ca9a79f6
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Projects
::
DestroyService
,
services:
true
do
describe
Projects
::
DestroyService
,
services:
true
do
let!
(
:user
)
{
create
(
:user
)
}
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!
(
:path
)
{
project
.
repository
.
path_to_repo
}
let!
(
:remove_path
)
{
path
.
sub
(
/\.git\Z/
,
"+
#{
project
.
id
}
+deleted.git"
)
}
let!
(
:remove_path
)
{
path
.
sub
(
/\.git\Z/
,
"+
#{
project
.
id
}
+deleted.git"
)
}
let!
(
:async
)
{
false
}
# execute or async_execute
let!
(
:async
)
{
false
}
# execute or async_execute
...
...
spec/services/projects/download_service_spec.rb
View file @
ca9a79f6
...
@@ -3,8 +3,8 @@ require 'spec_helper'
...
@@ -3,8 +3,8 @@ require 'spec_helper'
describe
Projects
::
DownloadService
,
services:
true
do
describe
Projects
::
DownloadService
,
services:
true
do
describe
'File service'
do
describe
'File service'
do
before
do
before
do
@user
=
create
:user
@user
=
create
(
:user
)
@project
=
create
:project
,
creator_id:
@user
.
id
,
namespace:
@user
.
namespace
@project
=
create
(
:empty_project
,
creator_id:
@user
.
id
,
namespace:
@user
.
namespace
)
end
end
context
'for a URL that is not on whitelist'
do
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
...
@@ -7,6 +7,7 @@ describe Projects::ForkService, services: true do
@from_user
=
create
(
:user
,
namespace:
@from_namespace
)
@from_user
=
create
(
:user
,
namespace:
@from_namespace
)
avatar
=
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
)
avatar
=
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
)
@from_project
=
create
(
:project
,
@from_project
=
create
(
:project
,
:repository
,
creator_id:
@from_user
.
id
,
creator_id:
@from_user
.
id
,
namespace:
@from_namespace
,
namespace:
@from_namespace
,
star_count:
107
,
star_count:
107
,
...
@@ -54,7 +55,7 @@ describe Projects::ForkService, services: true do
...
@@ -54,7 +55,7 @@ describe Projects::ForkService, services: true do
context
'project already exists'
do
context
'project already exists'
do
it
"fails due to validation, not transaction failure"
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
)
@to_project
=
fork_project
(
@from_project
,
@to_user
)
expect
(
@existing_project
).
to
be_persisted
expect
(
@existing_project
).
to
be_persisted
...
@@ -104,9 +105,10 @@ describe Projects::ForkService, services: true do
...
@@ -104,9 +105,10 @@ describe Projects::ForkService, services: true do
before
do
before
do
@group_owner
=
create
(
:user
)
@group_owner
=
create
(
:user
)
@developer
=
create
(
:user
)
@developer
=
create
(
:user
)
@project
=
create
(
:project
,
creator_id:
@group_owner
.
id
,
@project
=
create
(
:project
,
:repository
,
star_count:
777
,
creator_id:
@group_owner
.
id
,
description:
'Wow, such a cool project!'
)
star_count:
777
,
description:
'Wow, such a cool project!'
)
@group
=
create
(
:group
)
@group
=
create
(
:group
)
@group
.
add_user
(
@group_owner
,
GroupMember
::
OWNER
)
@group
.
add_user
(
@group_owner
,
GroupMember
::
OWNER
)
@group
.
add_user
(
@developer
,
GroupMember
::
DEVELOPER
)
@group
.
add_user
(
@developer
,
GroupMember
::
DEVELOPER
)
...
@@ -139,8 +141,9 @@ describe Projects::ForkService, services: true do
...
@@ -139,8 +141,9 @@ describe Projects::ForkService, services: true do
context
'project already exists in group'
do
context
'project already exists in group'
do
it
'fails due to validation, not transaction failure'
do
it
'fails due to validation, not transaction failure'
do
existing_project
=
create
(
:project
,
name:
@project
.
name
,
existing_project
=
create
(
:project
,
:repository
,
namespace:
@group
)
name:
@project
.
name
,
namespace:
@group
)
to_project
=
fork_project
(
@project
,
@group_owner
,
@opts
)
to_project
=
fork_project
(
@project
,
@group_owner
,
@opts
)
expect
(
existing_project
.
persisted?
).
to
be_truthy
expect
(
existing_project
.
persisted?
).
to
be_truthy
expect
(
to_project
.
errors
[
:name
]).
to
eq
([
'has already been taken'
])
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'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Projects
::
HousekeepingService
do
describe
Projects
::
HousekeepingService
do
subject
{
Projects
::
HousekeepingService
.
new
(
project
)
}
subject
{
Projects
::
HousekeepingService
.
new
(
project
)
}
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
project
.
reset_pushes_since_gc
project
.
reset_pushes_since_gc
...
...
spec/services/projects/transfer_service_spec.rb
View file @
ca9a79f6
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Projects
::
TransferService
,
services:
true
do
describe
Projects
::
TransferService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
context
'namespace -> namespace'
do
context
'namespace -> namespace'
do
before
do
before
do
...
@@ -58,7 +58,7 @@ describe Projects::TransferService, services: true do
...
@@ -58,7 +58,7 @@ describe Projects::TransferService, services: true do
before
{
internal_group
.
add_owner
(
user
)
}
before
{
internal_group
.
add_owner
(
user
)
}
context
'when namespace visibility level < project visibility level'
do
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
)
}
before
{
transfer_project
(
public_project
,
user
,
internal_group
)
}
...
@@ -66,7 +66,7 @@ describe Projects::TransferService, services: true do
...
@@ -66,7 +66,7 @@ describe Projects::TransferService, services: true do
end
end
context
'when namespace visibility level > project visibility level'
do
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
)
}
before
{
transfer_project
(
private_project
,
user
,
internal_group
)
}
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
ca9a79f6
require
"spec_helper"
require
"spec_helper"
describe
Projects
::
UpdatePagesService
do
describe
Projects
::
UpdatePagesService
do
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
create
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
(
'HEAD'
).
sha
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
(
'HEAD'
).
sha
)
}
let
(
:build
)
{
create
:ci_build
,
pipeline:
pipeline
,
ref:
'HEAD'
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
ref:
'HEAD'
)
}
let
(
:invalid_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
)
}
let
(
:invalid_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/dk.png'
)
}
subject
{
described_class
.
new
(
project
,
build
)
}
subject
{
described_class
.
new
(
project
,
build
)
}
...
...
spec/services/projects/update_service_spec.rb
View file @
ca9a79f6
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Projects
::
UpdateService
,
services:
true
do
describe
Projects
::
UpdateService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
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
describe
'update_by_user'
do
context
'when visibility_level is INTERNAL'
do
context
'when visibility_level is INTERNAL'
do
...
@@ -56,7 +56,7 @@ describe Projects::UpdateService, services: true do
...
@@ -56,7 +56,7 @@ describe Projects::UpdateService, services: true do
end
end
describe
'visibility_level'
do
describe
'visibility_level'
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:internal
)
}
let
(
:forked_project
)
{
create
(
:forked_project_with_submodules
,
:internal
)
}
let
(
:forked_project
)
{
create
(
:forked_project_with_submodules
,
:internal
)
}
before
do
before
do
...
...
spec/services/projects/upload_service_spec.rb
View file @
ca9a79f6
...
@@ -3,8 +3,8 @@ require 'spec_helper'
...
@@ -3,8 +3,8 @@ require 'spec_helper'
describe
Projects
::
UploadService
,
services:
true
do
describe
Projects
::
UploadService
,
services:
true
do
describe
'File service'
do
describe
'File service'
do
before
do
before
do
@user
=
create
:user
@user
=
create
(
:user
)
@project
=
create
:project
,
creator_id:
@user
.
id
,
namespace:
@user
.
namespace
@project
=
create
(
:empty_project
,
creator_id:
@user
.
id
,
namespace:
@user
.
namespace
)
end
end
context
'for valid gif file'
do
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
...
@@ -44,7 +44,7 @@ describe 'Search::GlobalService', services: true do
context
'nested group'
do
context
'nested group'
do
let!
(
:nested_group
)
{
create
(
:group
,
:nested
)
}
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
)
}
before
{
project
.
add_master
(
user
)
}
...
...
spec/services/slash_commands/interpret_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
SlashCommands
::
InterpretService
,
services:
true
do
describe
SlashCommands
::
InterpretService
,
services:
true
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
,
title:
'9.10'
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
,
title:
'9.10'
)
}
...
@@ -260,6 +260,8 @@ describe SlashCommands::InterpretService, services: true do
...
@@ -260,6 +260,8 @@ describe SlashCommands::InterpretService, services: true do
end
end
shared_examples
'merge command'
do
shared_examples
'merge command'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it
'runs merge command if content contains /merge'
do
it
'runs merge command if content contains /merge'
do
_
,
updates
=
service
.
execute
(
content
,
issuable
)
_
,
updates
=
service
.
execute
(
content
,
issuable
)
...
@@ -322,6 +324,7 @@ describe SlashCommands::InterpretService, services: true do
...
@@ -322,6 +324,7 @@ describe SlashCommands::InterpretService, services: true do
end
end
context
'when sha is missing'
do
context
'when sha is missing'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
developer
,
{})
}
let
(
:service
)
{
described_class
.
new
(
project
,
developer
,
{})
}
it
'precheck passes and returns merge command'
do
it
'precheck passes and returns merge command'
do
...
@@ -694,7 +697,7 @@ describe SlashCommands::InterpretService, services: true do
...
@@ -694,7 +697,7 @@ describe SlashCommands::InterpretService, services: true do
end
end
context
'/target_branch command'
do
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
(
:another_merge_request
)
{
create
(
:merge_request
,
author:
developer
,
source_project:
non_empty_project
)
}
let
(
:service
)
{
described_class
.
new
(
non_empty_project
,
developer
)}
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
...
@@ -15,7 +15,7 @@ describe SpamService, services: true do
end
end
context
'when recaptcha was not verified'
do
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
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:request
)
{
double
(
:request
,
env:
{})
}
let
(
:request
)
{
double
(
:request
,
env:
{})
}
...
...
spec/services/system_hooks_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
SystemHooksService
,
services:
true
do
describe
SystemHooksService
,
services:
true
do
let
(
:user
)
{
create
:user
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project_member
)
{
create
:project_member
}
let
(
:project_member
)
{
create
(
:project_member
)
}
let
(
:key
)
{
create
(
:key
,
user:
user
)
}
let
(
:key
)
{
create
(
:key
,
user:
user
)
}
let
(
:deploy_key
)
{
create
(
:key
)
}
let
(
:deploy_key
)
{
create
(
:key
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group_member
)
{
create
(
:group_member
)
}
let
(
:group_member
)
{
create
(
:group_member
)
}
context
'event data'
do
context
'event data'
do
it
{
expect
(
event_data
(
user
,
:create
)).
to
include
(
:event_name
,
:name
,
:created_at
,
:updated_at
,
:email
,
:user_id
,
:username
)
}
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'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
SystemNoteService
,
services:
true
do
describe
SystemNoteService
,
services:
true
do
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
.
url_helpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
...
@@ -32,6 +32,7 @@ describe SystemNoteService, services: true do
...
@@ -32,6 +32,7 @@ describe SystemNoteService, services: true do
describe
'.add_commits'
do
describe
'.add_commits'
do
subject
{
described_class
.
add_commits
(
noteable
,
project
,
author
,
new_commits
,
old_commits
,
oldrev
)
}
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
(
:noteable
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:new_commits
)
{
noteable
.
commits
}
let
(
:new_commits
)
{
noteable
.
commits
}
let
(
:old_commits
)
{
[]
}
let
(
:old_commits
)
{
[]
}
...
@@ -216,6 +217,7 @@ describe SystemNoteService, services: true do
...
@@ -216,6 +217,7 @@ describe SystemNoteService, services: true do
end
end
describe
'.merge_when_pipeline_succeeds'
do
describe
'.merge_when_pipeline_succeeds'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
build
(
:ci_pipeline_without_jobs
)}
let
(
:pipeline
)
{
build
(
:ci_pipeline_without_jobs
)}
let
(
:noteable
)
do
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
...
@@ -226,11 +228,12 @@ describe SystemNoteService, services: true do
...
@@ -226,11 +228,12 @@ describe SystemNoteService, services: true do
it_behaves_like
'a system note'
it_behaves_like
'a system note'
it
"posts the 'merge when pipeline succeeds' system note"
do
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
end
end
describe
'.cancel_merge_when_pipeline_succeeds'
do
describe
'.cancel_merge_when_pipeline_succeeds'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:noteable
)
do
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
end
end
...
@@ -273,6 +276,8 @@ describe SystemNoteService, services: true do
...
@@ -273,6 +276,8 @@ describe SystemNoteService, services: true do
describe
'.change_branch'
do
describe
'.change_branch'
do
subject
{
described_class
.
change_branch
(
noteable
,
project
,
author
,
'target'
,
old_branch
,
new_branch
)
}
subject
{
described_class
.
change_branch
(
noteable
,
project
,
author
,
'target'
,
old_branch
,
new_branch
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:old_branch
)
{
'old_branch'
}
let
(
:old_branch
)
{
'old_branch'
}
let
(
:new_branch
)
{
'new_branch'
}
let
(
:new_branch
)
{
'new_branch'
}
...
@@ -288,6 +293,8 @@ describe SystemNoteService, services: true do
...
@@ -288,6 +293,8 @@ describe SystemNoteService, services: true do
describe
'.change_branch_presence'
do
describe
'.change_branch_presence'
do
subject
{
described_class
.
change_branch_presence
(
noteable
,
project
,
author
,
:source
,
'feature'
,
:delete
)
}
subject
{
described_class
.
change_branch_presence
(
noteable
,
project
,
author
,
:source
,
'feature'
,
:delete
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it_behaves_like
'a system note'
it_behaves_like
'a system note'
context
'when source branch deleted'
do
context
'when source branch deleted'
do
...
@@ -300,11 +307,13 @@ describe SystemNoteService, services: true do
...
@@ -300,11 +307,13 @@ describe SystemNoteService, services: true do
describe
'.new_issue_branch'
do
describe
'.new_issue_branch'
do
subject
{
described_class
.
new_issue_branch
(
noteable
,
project
,
author
,
"1-mepmep"
)
}
subject
{
described_class
.
new_issue_branch
(
noteable
,
project
,
author
,
"1-mepmep"
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it_behaves_like
'a system note'
it_behaves_like
'a system note'
context
'when a branch is created from the new branch button'
do
context
'when a branch is created from the new branch button'
do
it
'sets the note text'
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
end
end
end
...
@@ -333,7 +342,7 @@ describe SystemNoteService, services: true do
...
@@ -333,7 +342,7 @@ describe SystemNoteService, services: true do
describe
'note_body'
do
describe
'note_body'
do
context
'cross-project'
do
context
'cross-project'
do
let
(
:project2
)
{
create
(
:project
)
}
let
(
:project2
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
create
(
:issue
,
project:
project2
)
}
let
(
:mentioner
)
{
create
(
:issue
,
project:
project2
)
}
context
'from Commit'
do
context
'from Commit'
do
...
@@ -353,6 +362,7 @@ describe SystemNoteService, services: true do
...
@@ -353,6 +362,7 @@ describe SystemNoteService, services: true do
context
'within the same project'
do
context
'within the same project'
do
context
'from Commit'
do
context
'from Commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
project
.
repository
.
commit
}
let
(
:mentioner
)
{
project
.
repository
.
commit
}
it
'references the mentioning commit'
do
it
'references the mentioning commit'
do
...
@@ -394,6 +404,7 @@ describe SystemNoteService, services: true do
...
@@ -394,6 +404,7 @@ describe SystemNoteService, services: true do
end
end
context
'when mentioner is a MergeRequest'
do
context
'when mentioner is a MergeRequest'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:mentioner
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
)
}
let
(
:mentioner
)
{
create
(
:merge_request
,
:simple
,
source_project:
project
)
}
let
(
:noteable
)
{
project
.
commit
}
let
(
:noteable
)
{
project
.
commit
}
...
@@ -421,6 +432,7 @@ describe SystemNoteService, services: true do
...
@@ -421,6 +432,7 @@ describe SystemNoteService, services: true do
end
end
describe
'.cross_reference_exists?'
do
describe
'.cross_reference_exists?'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit0
)
{
project
.
commit
}
let
(
:commit0
)
{
project
.
commit
}
let
(
:commit1
)
{
project
.
commit
(
'HEAD~2'
)
}
let
(
:commit1
)
{
project
.
commit
(
'HEAD~2'
)
}
...
@@ -513,7 +525,7 @@ describe SystemNoteService, services: true do
...
@@ -513,7 +525,7 @@ describe SystemNoteService, services: true do
end
end
describe
'.noteable_moved'
do
describe
'.noteable_moved'
do
let
(
:new_project
)
{
create
(
:project
)
}
let
(
:new_project
)
{
create
(
:
empty_
project
)
}
let
(
:new_noteable
)
{
create
(
:issue
,
project:
new_project
)
}
let
(
:new_noteable
)
{
create
(
:issue
,
project:
new_project
)
}
subject
do
subject
do
...
@@ -542,7 +554,7 @@ describe SystemNoteService, services: true do
...
@@ -542,7 +554,7 @@ describe SystemNoteService, services: true do
it_behaves_like
'cross project mentionable'
it_behaves_like
'cross project mentionable'
it
'notifies about noteable being moved to'
do
it
'notifies about noteable being moved to'
do
expect
(
subject
.
note
).
to
match
/moved to/
expect
(
subject
.
note
).
to
match
(
'moved to'
)
end
end
end
end
...
@@ -552,7 +564,7 @@ describe SystemNoteService, services: true do
...
@@ -552,7 +564,7 @@ describe SystemNoteService, services: true do
it_behaves_like
'cross project mentionable'
it_behaves_like
'cross project mentionable'
it
'notifies about noteable being moved from'
do
it
'notifies about noteable being moved from'
do
expect
(
subject
.
note
).
to
match
/moved from/
expect
(
subject
.
note
).
to
match
(
'moved from'
)
end
end
end
end
...
@@ -574,13 +586,13 @@ describe SystemNoteService, services: true do
...
@@ -574,13 +586,13 @@ describe SystemNoteService, services: true do
end
end
end
end
include
JiraServiceHelper
describe
'JIRA integration'
do
describe
'JIRA integration'
do
include
JiraServiceHelper
let
(
:project
)
{
create
(
:jira_project
)
}
let
(
:project
)
{
create
(
:jira_project
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
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_issue
)
{
ExternalIssue
.
new
(
"JIRA-1"
,
project
)}
let
(
:jira_tracker
)
{
project
.
jira_service
}
let
(
:jira_tracker
)
{
project
.
jira_service
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
...
@@ -809,6 +821,7 @@ describe SystemNoteService, services: true do
...
@@ -809,6 +821,7 @@ describe SystemNoteService, services: true do
end
end
describe
'.add_merge_request_wip_from_commit'
do
describe
'.add_merge_request_wip_from_commit'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:noteable
)
do
let
(
:noteable
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
end
end
...
...
spec/services/tags/create_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
Tags
::
CreateService
,
services:
true
do
describe
Tags
::
CreateService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:repository
)
{
project
.
repository
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
...
...
spec/services/tags/destroy_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
Tags
::
DestroyService
,
services:
true
do
describe
Tags
::
DestroyService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:repository
)
{
project
.
repository
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
)
}
...
...
spec/services/test_hook_service_spec.rb
View file @
ca9a79f6
require
'spec_helper'
require
'spec_helper'
describe
TestHookService
,
services:
true
do
describe
TestHookService
,
services:
true
do
let
(
:user
)
{
create
:user
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:hook
)
{
create
:project_hook
,
project:
project
}
let
(
:hook
)
{
create
(
:project_hook
,
project:
project
)
}
describe
'#execute'
do
describe
'#execute'
do
it
"executes successfully"
do
it
"executes successfully"
do
...
...
spec/services/todo_service_spec.rb
View file @
ca9a79f6
...
@@ -8,7 +8,7 @@ describe TodoService, services: true do
...
@@ -8,7 +8,7 @@ describe TodoService, services: true do
let
(
:guest
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:john_doe
)
{
create
(
:user
)
}
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
(
: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
)
{
[
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
(
' '
)
}
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
...
@@ -99,9 +99,9 @@ describe TodoService, services: true do
end
end
context
'when a private group is mentioned'
do
context
'when a private group is mentioned'
do
let
(
:group
)
{
create
:group
,
:private
}
let
(
:group
)
{
create
(
:group
,
:private
)
}
let
(
:project
)
{
create
:project
,
:private
,
group:
group
}
let
(
:project
)
{
create
(
:empty_project
,
:private
,
group:
group
)
}
let
(
:issue
)
{
create
:issue
,
author:
author
,
project:
project
,
description:
group
.
to_reference
}
let
(
:issue
)
{
create
(
:issue
,
author:
author
,
project:
project
,
description:
group
.
to_reference
)
}
before
do
before
do
group
.
add_owner
(
author
)
group
.
add_owner
(
author
)
...
@@ -422,22 +422,26 @@ describe TodoService, services: true do
...
@@ -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
)
should_create_todo
(
user:
john_doe
,
target:
confidential_issue
,
author:
john_doe
,
action:
Todo
::
DIRECTLY_ADDRESSED
,
note:
addressed_note_on_confidential_issue
)
end
end
it
'creates a todo for each valid mentioned user when leaving a note
on commit'
do
context
'
on commit'
do
service
.
new_note
(
note_on_commit
,
john_doe
)
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
)
it
'creates a todo for each valid mentioned user when leaving a note on commit'
do
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
)
service
.
new_note
(
note_on_commit
,
john_doe
)
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
)
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
)
end
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
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
)
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:
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:
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_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_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
end
it
'does not create todo when leaving a note on snippet'
do
it
'does not create todo when leaving a note on snippet'
do
...
@@ -720,6 +724,7 @@ describe TodoService, services: true do
...
@@ -720,6 +724,7 @@ describe TodoService, services: true do
end
end
describe
'#new_note'
do
describe
'#new_note'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:mention
)
{
john_doe
.
to_reference
}
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
(
: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!"
)
}
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'
require
'spec_helper'
describe
UpdateReleaseService
,
services:
true
do
describe
UpdateReleaseService
,
services:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
first
}
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
first
}
let
(
:description
)
{
'Awesome release!'
}
let
(
:description
)
{
'Awesome release!'
}
...
...
spec/services/users/destroy_spec.rb
View file @
ca9a79f6
...
@@ -5,7 +5,7 @@ describe Users::DestroyService, services: true do
...
@@ -5,7 +5,7 @@ describe Users::DestroyService, services: true do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:admin
)
{
create
(
:admin
)
}
let!
(
:admin
)
{
create
(
:admin
)
}
let!
(
:namespace
)
{
create
(
:namespace
,
owner:
user
)
}
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
)
}
let
(
:service
)
{
described_class
.
new
(
admin
)
}
context
'no options are given'
do
context
'no options are given'
do
...
@@ -25,7 +25,7 @@ describe Users::DestroyService, services: true do
...
@@ -25,7 +25,7 @@ describe Users::DestroyService, services: true do
end
end
context
"a deleted user's issues"
do
context
"a deleted user's issues"
do
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:project
)
}
before
do
before
do
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
...
...
spec/services/users/refresh_authorized_projects_service_spec.rb
View file @
ca9a79f6
...
@@ -152,7 +152,7 @@ describe Users::RefreshAuthorizedProjectsService do
...
@@ -152,7 +152,7 @@ describe Users::RefreshAuthorizedProjectsService do
context
'projects of groups the user is a member of'
do
context
'projects of groups the user is a member of'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let!
(
:other_project
)
{
create
(
:project
,
group:
group
)
}
let!
(
:other_project
)
{
create
(
:
empty_
project
,
group:
group
)
}
before
do
before
do
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
...
@@ -166,7 +166,7 @@ describe Users::RefreshAuthorizedProjectsService do
...
@@ -166,7 +166,7 @@ describe Users::RefreshAuthorizedProjectsService do
context
'projects of subgroups of groups the user is a member of'
do
context
'projects of subgroups of groups the user is a member of'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:nested_group
)
{
create
(
:group
,
parent:
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
before
do
group
.
add_master
(
user
)
group
.
add_master
(
user
)
...
...
spec/support/services/issuable_create_service_slash_commands_shared_examples.rb
View file @
ca9a79f6
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# It can take a `default_params`.
# It can take a `default_params`.
shared_examples
'new issuable record that supports slash commands'
do
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
(
:user
)
{
create
(
:user
).
tap
{
|
u
|
project
.
team
<<
[
u
,
:master
]
}
}
let
(
:assignee
)
{
create
(
:user
)
}
let
(
:assignee
)
{
create
(
:user
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
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