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
79fdee35
Commit
79fdee35
authored
Apr 03, 2019
by
Alexandru Croitor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract merge quick action to a shared example
parent
12522d22
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
68 deletions
+49
-68
spec/features/merge_request/user_uses_quick_actions_spec.rb
spec/features/merge_request/user_uses_quick_actions_spec.rb
+2
-68
spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb
...tions/merge_request/merge_quick_action_shared_examples.rb
+47
-0
No files found.
spec/features/merge_request/user_uses_quick_actions_spec.rb
View file @
79fdee35
...
@@ -56,6 +56,8 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -56,6 +56,8 @@ describe 'Merge request > User uses quick actions', :js do
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
end
end
it_behaves_like
'merge quick action'
describe
'toggling the WIP prefix in the title from note'
do
describe
'toggling the WIP prefix in the title from note'
do
context
'when the current user can toggle the WIP prefix'
do
context
'when the current user can toggle the WIP prefix'
do
before
do
before
do
...
@@ -103,74 +105,6 @@ describe 'Merge request > User uses quick actions', :js do
...
@@ -103,74 +105,6 @@ describe 'Merge request > User uses quick actions', :js do
end
end
end
end
describe
'merging the MR from the note'
do
context
'when the current user can merge the MR'
do
before
do
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'merges the MR'
do
add_note
(
"/merge"
)
expect
(
page
).
to
have_content
'Commands applied'
expect
(
merge_request
.
reload
).
to
be_merged
end
end
context
'when the head diff changes in the meanwhile'
do
before
do
merge_request
.
source_branch
=
'another_branch'
merge_request
.
save
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'does not merge the MR'
do
add_note
(
"/merge"
)
expect
(
page
).
not_to
have_content
'Your commands have been executed!'
expect
(
merge_request
.
reload
).
not_to
be_merged
end
end
context
'when the current user cannot merge the MR'
do
before
do
project
.
add_guest
(
guest
)
sign_in
(
guest
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'does not merge the MR'
do
add_note
(
"/merge"
)
expect
(
page
).
not_to
have_content
'Your commands have been executed!'
expect
(
merge_request
.
reload
).
not_to
be_merged
end
end
end
describe
'adding a due date from note'
do
before
do
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it_behaves_like
'due quick action not available'
end
describe
'removing a due date from note'
do
before
do
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it_behaves_like
'remove_due_date action not available'
end
describe
'/target_branch command in merge request'
do
describe
'/target_branch command in merge request'
do
let
(
:another_project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:another_project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:new_url_opts
)
{
{
merge_request:
{
source_branch:
'feature'
}
}
}
let
(
:new_url_opts
)
{
{
merge_request:
{
source_branch:
'feature'
}
}
}
...
...
spec/support/shared_examples/quick_actions/merge_request/merge_quick_action_shared_examples.rb
View file @
79fdee35
# frozen_string_literal: true
# frozen_string_literal: true
shared_examples
'merge quick action'
do
shared_examples
'merge quick action'
do
context
'when the current user can merge the MR'
do
before
do
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'merges the MR'
do
add_note
(
"/merge"
)
expect
(
page
).
to
have_content
'Commands applied'
expect
(
merge_request
.
reload
).
to
be_merged
end
end
context
'when the head diff changes in the meanwhile'
do
before
do
merge_request
.
source_branch
=
'another_branch'
merge_request
.
save
sign_in
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'does not merge the MR'
do
add_note
(
"/merge"
)
expect
(
page
).
not_to
have_content
'Your commands have been executed!'
expect
(
merge_request
.
reload
).
not_to
be_merged
end
end
context
'when the current user cannot merge the MR'
do
before
do
project
.
add_guest
(
guest
)
sign_in
(
guest
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'does not merge the MR'
do
add_note
(
"/merge"
)
expect
(
page
).
not_to
have_content
'Your commands have been executed!'
expect
(
merge_request
.
reload
).
not_to
be_merged
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