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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
9956117c
Commit
9956117c
authored
Apr 02, 2020
by
nicolasdular
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
De-dupe MR create service EE specs
De-duplicates the MR create service specs
parent
c8557573
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
36 deletions
+27
-36
.rubocop.yml
.rubocop.yml
+0
-2
ee/spec/services/ee/merge_requests/create_service_spec.rb
ee/spec/services/ee/merge_requests/create_service_spec.rb
+27
-2
ee/spec/services/merge_requests/create_service_spec.rb
ee/spec/services/merge_requests/create_service_spec.rb
+0
-32
No files found.
.rubocop.yml
View file @
9956117c
...
@@ -217,12 +217,10 @@ Gitlab/DuplicateSpecLocation:
...
@@ -217,12 +217,10 @@ Gitlab/DuplicateSpecLocation:
-
ee/spec/helpers/auth_helper_spec.rb
-
ee/spec/helpers/auth_helper_spec.rb
-
ee/spec/lib/gitlab/gl_repository_spec.rb
-
ee/spec/lib/gitlab/gl_repository_spec.rb
-
ee/spec/models/namespace_spec.rb
-
ee/spec/models/namespace_spec.rb
-
ee/spec/services/merge_requests/create_service_spec.rb
-
ee/spec/services/merge_requests/refresh_service_spec.rb
-
ee/spec/services/merge_requests/refresh_service_spec.rb
-
ee/spec/services/merge_requests/update_service_spec.rb
-
ee/spec/services/merge_requests/update_service_spec.rb
-
ee/spec/helpers/ee/auth_helper_spec.rb
-
ee/spec/helpers/ee/auth_helper_spec.rb
-
ee/spec/models/ee/namespace_spec.rb
-
ee/spec/models/ee/namespace_spec.rb
-
ee/spec/services/ee/merge_requests/create_service_spec.rb
-
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
-
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
-
ee/spec/services/ee/merge_requests/update_service_spec.rb
-
ee/spec/services/ee/merge_requests/update_service_spec.rb
...
...
ee/spec/services/ee/merge_requests/create_service_spec.rb
View file @
9956117c
...
@@ -6,7 +6,6 @@ describe MergeRequests::CreateService do
...
@@ -6,7 +6,6 @@ describe MergeRequests::CreateService do
include
ProjectForksHelper
include
ProjectForksHelper
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
,
opts
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
,
opts
)
}
let
(
:opts
)
do
let
(
:opts
)
do
{
{
...
@@ -19,11 +18,16 @@ describe MergeRequests::CreateService do
...
@@ -19,11 +18,16 @@ describe MergeRequests::CreateService do
end
end
before
do
before
do
project
.
add_maintainer
(
user
)
allow
(
service
).
to
receive
(
:execute_hooks
)
allow
(
service
).
to
receive
(
:execute_hooks
)
end
end
describe
'#execute'
do
describe
'#execute'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_maintainer
(
user
)
end
it
'refreshes code owners for the merge request'
do
it
'refreshes code owners for the merge request'
do
fake_refresh_service
=
instance_double
(
::
MergeRequests
::
SyncCodeOwnerApprovalRules
)
fake_refresh_service
=
instance_double
(
::
MergeRequests
::
SyncCodeOwnerApprovalRules
)
...
@@ -69,4 +73,25 @@ describe MergeRequests::CreateService do
...
@@ -69,4 +73,25 @@ describe MergeRequests::CreateService do
let
(
:parent
)
{
project
}
let
(
:parent
)
{
project
}
end
end
end
end
describe
'#execute with blocking merge requests'
,
:clean_gitlab_redis_shared_state
do
let
(
:opts
)
{
{
title:
'Blocked MR'
,
source_branch:
'feature'
,
target_branch:
'master'
}
}
let
(
:user
)
{
project
.
owner
}
it
'delegates to MergeRequests::UpdateBlocksService'
do
expect
(
MergeRequests
::
UpdateBlocksService
)
.
to
receive
(
:extract_params!
)
.
and_return
(
:extracted_params
)
expect_next_instance_of
(
MergeRequests
::
UpdateBlocksService
)
do
|
block_service
|
expect
(
block_service
.
merge_request
.
title
).
to
eq
(
'Blocked MR'
)
expect
(
block_service
.
current_user
).
to
eq
(
user
)
expect
(
block_service
.
params
).
to
eq
(
:extracted_params
)
expect
(
block_service
).
to
receive
(
:execute
)
end
service
.
execute
end
end
end
end
ee/spec/services/merge_requests/create_service_spec.rb
deleted
100644 → 0
View file @
c8557573
# frozen_string_literal: true
require
'spec_helper'
describe
MergeRequests
::
CreateService
,
:clean_gitlab_redis_shared_state
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
project
.
owner
}
subject
(
:service
)
{
described_class
.
new
(
project
,
user
,
params
)
}
describe
'#execute'
do
context
'with blocking merge requests'
do
let
(
:params
)
{
{
title:
'Blocked MR'
,
source_branch:
'feature'
,
target_branch:
'master'
}
}
it
'delegates to MergeRequests::UpdateBlocksService'
do
expect
(
MergeRequests
::
UpdateBlocksService
)
.
to
receive
(
:extract_params!
)
.
and_return
(
:extracted_params
)
expect_next_instance_of
(
MergeRequests
::
UpdateBlocksService
)
do
|
block_service
|
expect
(
block_service
.
merge_request
.
title
).
to
eq
(
'Blocked MR'
)
expect
(
block_service
.
current_user
).
to
eq
(
user
)
expect
(
block_service
.
params
).
to
eq
(
:extracted_params
)
expect
(
block_service
).
to
receive
(
:execute
)
end
service
.
execute
end
end
end
end
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