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
70bac4de
Commit
70bac4de
authored
Apr 09, 2019
by
Heinrich Lee Yu
Committed by
Rémy Coutable
Apr 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE-specific feature specs
Extracts EE-specific Merge Request feature specs to /ee
parent
ef00dfcd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
77 deletions
+129
-77
ee/spec/features/merge_request/user_creates_merge_request_spec.rb
...features/merge_request/user_creates_merge_request_spec.rb
+71
-0
ee/spec/features/merge_request/user_sees_closing_issues_message_spec.rb
...es/merge_request/user_sees_closing_issues_message_spec.rb
+35
-0
ee/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb
...es/merge_request/user_selects_branches_for_new_mr_spec.rb
+21
-0
spec/features/merge_request/user_creates_merge_request_spec.rb
...features/merge_request/user_creates_merge_request_spec.rb
+2
-42
spec/features/merge_request/user_sees_closing_issues_message_spec.rb
...es/merge_request/user_sees_closing_issues_message_spec.rb
+0
-14
spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb
...es/merge_request/user_selects_branches_for_new_mr_spec.rb
+0
-21
No files found.
ee/spec/features/merge_request/user_creates_merge_request_spec.rb
0 → 100644
View file @
70bac4de
# frozen_string_literal: true
require
"spec_helper"
describe
"User creates a merge request"
,
:js
do
include
ProjectForksHelper
let
(
:approver
)
{
create
(
:user
)
}
let
(
:project
)
do
create
(
:project
,
:repository
,
approvals_before_merge:
1
,
merge_requests_template:
template_text
)
end
let
(
:template_text
)
{
"This merge request should contain the following."
}
let
(
:title
)
{
"Some feature"
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
before
do
stub_feature_flags
(
approval_rules:
false
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user2
)
project
.
add_maintainer
(
approver
)
sign_in
(
user
)
project
.
approvers
.
create
(
user_id:
approver
.
id
)
visit
(
project_new_merge_request_path
(
project
))
end
it
"creates a merge request"
do
allow_any_instance_of
(
Gitlab
::
AuthorityAnalyzer
).
to
receive
(
:calculate
).
and_return
([
user2
])
find
(
".js-source-branch"
).
click
click_link
(
"fix"
)
find
(
".js-target-branch"
).
click
click_link
(
"feature"
)
click_button
(
"Compare branches"
)
expect
(
find_field
(
"merge_request_description"
).
value
).
to
eq
(
template_text
)
page
.
within
(
"ul .unsaved-approvers"
)
do
expect
(
page
).
to
have_content
(
approver
.
name
)
end
page
.
within
(
".suggested-approvers"
)
do
expect
(
page
).
to
have_content
(
user2
.
name
)
end
click_link
(
user2
.
name
)
page
.
within
(
"ul.approver-list"
)
do
expect
(
page
).
to
have_content
(
user2
.
name
)
end
fill_in
(
"Title"
,
with:
title
)
click_button
(
"Submit merge request"
)
page
.
within
(
".js-issuable-actions"
)
do
click_link
(
"Edit"
,
match: :first
)
end
page
.
within
(
"ul.approver-list"
)
do
expect
(
page
).
to
have_content
(
user2
.
name
)
end
end
end
ee/spec/features/merge_request/user_sees_closing_issues_message_spec.rb
0 → 100644
View file @
70bac4de
# frozen_string_literal: true
require
"spec_helper"
describe
'Merge request > User sees closing issues message'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:user
)
{
project
.
creator
}
let
(
:issue_1
)
{
create
(
:issue
,
project:
project
)}
let
(
:issue_2
)
{
create
(
:issue
,
project:
project
)}
let
(
:merge_request
)
do
create
(
:merge_request
,
:simple
,
source_project:
project
,
description:
merge_request_description
)
end
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
wait_for_requests
end
context
'approvals are enabled while closing issues'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
approvals_before_merge:
1
)
}
let
(
:merge_request_description
)
{
"Description
\n\n
closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
it
'displays closing issue message exactly one time'
do
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
,
count:
1
)
end
end
end
ee/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb
View file @
70bac4de
...
...
@@ -26,4 +26,25 @@ describe 'Merge request > User selects branches for new MR', :js do
expect
(
page
).
to
have_content
(
'Approvers'
)
end
end
context
'when approvals are enabled for the target project'
do
before
do
project
.
update
(
approvals_before_merge:
1
)
visit
project_new_merge_request_path
(
project
,
merge_request:
{
target_branch:
'master'
,
source_branch:
'feature_conflict'
})
end
it
'shows approval settings'
do
expect
(
page
).
to
have_content
(
'Approvers'
)
end
context
'saving the MR'
do
it
'shows the saved MR'
do
fill_in
'merge_request_title'
,
with:
'Test'
click_button
'Submit merge request'
expect
(
page
).
to
have_link
(
'Close merge request'
)
end
end
end
end
spec/features/merge_request/user_creates_merge_request_spec.rb
View file @
70bac4de
...
...
@@ -3,33 +3,19 @@ require "spec_helper"
describe
"User creates a merge request"
,
:js
do
include
ProjectForksHelper
let
(
:approver
)
{
create
(
:user
)
}
let
(
:project
)
do
create
(
:project
,
:repository
,
approvals_before_merge:
1
,
merge_requests_template:
template_text
)
end
let
(
:template_text
)
{
"This merge request should contain the following."
}
let
(
:title
)
{
"Some feature"
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
before
do
stub_feature_flags
(
approval_rules:
false
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user2
)
project
.
add_maintainer
(
approver
)
sign_in
(
user
)
project
.
approvers
.
create
(
user_id:
approver
.
id
)
visit
(
project_new_merge_request_path
(
project
))
end
it
"creates a merge request"
do
allow_any_instance_of
(
Gitlab
::
AuthorityAnalyzer
).
to
receive
(
:calculate
).
and_return
([
user2
]
)
visit
(
project_new_merge_request_path
(
project
)
)
find
(
".js-source-branch"
).
click
click_link
(
"fix"
)
...
...
@@ -39,38 +25,12 @@ describe "User creates a merge request", :js do
click_button
(
"Compare branches"
)
expect
(
find_field
(
"merge_request_description"
).
value
).
to
eq
(
template_text
)
# Approvers
page
.
within
(
"ul .unsaved-approvers"
)
do
expect
(
page
).
to
have_content
(
approver
.
name
)
end
page
.
within
(
".suggested-approvers"
)
do
expect
(
page
).
to
have_content
(
user2
.
name
)
end
click_link
(
user2
.
name
)
page
.
within
(
"ul.approver-list"
)
do
expect
(
page
).
to
have_content
(
user2
.
name
)
end
# End of approvers
fill_in
(
"Title"
,
with:
title
)
click_button
(
"Submit merge request"
)
page
.
within
(
".merge-request"
)
do
expect
(
page
).
to
have_content
(
title
)
end
page
.
within
(
".js-issuable-actions"
)
do
click_link
(
"Edit"
,
match: :first
)
end
page
.
within
(
"ul.approver-list"
)
do
expect
(
page
).
to
have_content
(
user2
.
name
)
end
end
context
"to a forked project"
do
...
...
spec/features/merge_request/user_sees_closing_issues_message_spec.rb
View file @
70bac4de
...
...
@@ -73,18 +73,4 @@ describe 'Merge request > User sees closing issues message', :js do
expect
(
page
).
to
have_content
(
"Mentions
#{
issue_2
.
to_reference
}
"
)
end
end
context
'approvals are enabled while closing issues'
,
:js
do
before
do
project
.
add_developer
(
user
)
end
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
approvals_before_merge:
1
)
}
let
(
:merge_request_description
)
{
"Description
\n\n
closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
it
'displays closing issue message exactly one time'
do
wait_for_requests
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
,
count:
1
)
end
end
end
spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb
View file @
70bac4de
...
...
@@ -86,27 +86,6 @@ describe 'Merge request > User selects branches for new MR', :js do
expect
(
target_items
.
count
).
to
be
>
1
end
context
'when approvals are enabled for the target project'
do
before
do
project
.
update
(
approvals_before_merge:
1
)
visit
project_new_merge_request_path
(
project
,
merge_request:
{
target_branch:
'master'
,
source_branch:
'feature_conflict'
})
end
it
'shows approval settings'
do
expect
(
page
).
to
have_content
(
'Approvers'
)
end
context
'saving the MR'
do
it
'shows the saved MR'
do
fill_in
'merge_request_title'
,
with:
'Test'
click_button
'Submit merge request'
expect
(
page
).
to
have_link
(
'Close merge request'
)
end
end
end
context
'when target project cannot be viewed by the current user'
do
it
'does not leak the private project name & namespace'
do
private_project
=
create
(
:project
,
:private
,
:repository
)
...
...
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