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
2e05c507
Commit
2e05c507
authored
Apr 03, 2019
by
Alexandru Croitor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract move quick action spec to shared example
parent
4b22bf75
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
123 deletions
+93
-123
ee/spec/features/issues/user_uses_quick_actions_spec.rb
ee/spec/features/issues/user_uses_quick_actions_spec.rb
+3
-3
spec/features/issues/user_uses_quick_actions_spec.rb
spec/features/issues/user_uses_quick_actions_spec.rb
+1
-120
spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb
.../quick_actions/issue/move_quick_action_shared_examples.rb
+89
-0
No files found.
ee/spec/features/issues/user_uses_quick_actions_spec.rb
View file @
2e05c507
...
...
@@ -7,12 +7,14 @@ describe 'Issues > User uses quick actions', :js do
describe
'issue-only commands'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
project_issue_path
(
project
,
issue
)
wait_for_all_requests
end
after
do
...
...
@@ -20,8 +22,6 @@ describe 'Issues > User uses quick actions', :js do
end
describe
'adding a weight from a note'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
context
'when the user can update the weight'
do
it
'does not create a note, and sets the weight accordingly'
do
add_note
(
"/weight 5"
)
...
...
spec/features/issues/user_uses_quick_actions_spec.rb
View file @
2e05c507
...
...
@@ -63,125 +63,6 @@ describe 'Issues > User uses quick actions', :js do
it_behaves_like
'duplicate quick action'
it_behaves_like
'create_merge_request quick action'
it_behaves_like
'due quick action'
describe
'move the issue to another project'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
context
'when the project is valid'
do
let
(
:target_project
)
{
create
(
:project
,
:public
)
}
before
do
target_project
.
add_maintainer
(
user
)
gitlab_sign_out
sign_in
(
user
)
visit
project_issue_path
(
project
,
issue
)
wait_for_requests
end
it
'moves the issue'
do
add_note
(
"/move
#{
target_project
.
full_path
}
"
)
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_closed
visit
project_issue_path
(
target_project
,
issue
)
expect
(
page
).
to
have_content
'Issues 1'
end
end
context
'when the project is valid but the user not authorized'
do
let
(
:project_unauthorized
)
{
create
(
:project
,
:public
)
}
before
do
gitlab_sign_out
sign_in
(
user
)
visit
project_issue_path
(
project
,
issue
)
wait_for_requests
end
it
'does not move the issue'
do
add_note
(
"/move
#{
project_unauthorized
.
full_path
}
"
)
wait_for_requests
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_open
end
end
context
'when the project is invalid'
do
before
do
gitlab_sign_out
sign_in
(
user
)
visit
project_issue_path
(
project
,
issue
)
wait_for_requests
end
it
'does not move the issue'
do
add_note
(
"/move not/valid"
)
wait_for_requests
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_open
end
end
context
'when the user issues multiple commands'
do
let
(
:target_project
)
{
create
(
:project
,
:public
)
}
let
(
:milestone
)
{
create
(
:milestone
,
title:
'1.0'
,
project:
project
)
}
let
(
:target_milestone
)
{
create
(
:milestone
,
title:
'1.0'
,
project:
target_project
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let
(
:wontfix
)
{
create
(
:label
,
project:
project
,
title:
'wontfix'
)
}
let
(
:bug_target
)
{
create
(
:label
,
project:
target_project
,
title:
'bug'
)
}
let
(
:wontfix_target
)
{
create
(
:label
,
project:
target_project
,
title:
'wontfix'
)
}
before
do
target_project
.
add_maintainer
(
user
)
gitlab_sign_out
sign_in
(
user
)
visit
project_issue_path
(
project
,
issue
)
end
it
'applies the commands to both issues and moves the issue'
do
add_note
(
"/label ~
#{
bug
.
title
}
~
#{
wontfix
.
title
}
\n\n
/milestone %
\"
#{
milestone
.
title
}
\"\n\n
/move
#{
target_project
.
full_path
}
"
)
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_closed
visit
project_issue_path
(
target_project
,
issue
)
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'1.0'
visit
project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_content
'Closed'
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'1.0'
end
it
'moves the issue and applies the commands to both issues'
do
add_note
(
"/move
#{
target_project
.
full_path
}
\n\n
/label ~
#{
bug
.
title
}
~
#{
wontfix
.
title
}
\n\n
/milestone %
\"
#{
milestone
.
title
}
\"
"
)
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_closed
visit
project_issue_path
(
target_project
,
issue
)
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'1.0'
visit
project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_content
'Closed'
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'1.0'
end
end
end
it_behaves_like
'move quick action'
end
end
spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb
View file @
2e05c507
# frozen_string_literal: true
shared_examples
'move quick action'
do
context
'move the issue to another project'
do
let
(
:target_project
)
{
create
(
:project
,
:public
)
}
context
'when the project is valid'
do
before
do
target_project
.
add_maintainer
(
user
)
end
it
'moves the issue'
do
add_note
(
"/move
#{
target_project
.
full_path
}
"
)
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_closed
visit
project_issue_path
(
target_project
,
issue
)
expect
(
page
).
to
have_content
'Issues 1'
end
end
context
'when the project is valid but the user not authorized'
do
let
(
:project_unauthorized
)
{
create
(
:project
,
:public
)
}
it
'does not move the issue'
do
add_note
(
"/move
#{
project_unauthorized
.
full_path
}
"
)
wait_for_requests
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_open
end
end
context
'when the project is invalid'
do
it
'does not move the issue'
do
add_note
(
"/move not/valid"
)
wait_for_requests
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_open
end
end
context
'when the user issues multiple commands'
do
let
(
:milestone
)
{
create
(
:milestone
,
title:
'1.0'
,
project:
project
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let
(
:wontfix
)
{
create
(
:label
,
project:
project
,
title:
'wontfix'
)
}
before
do
target_project
.
add_maintainer
(
user
)
end
shared_examples
'applies the commands to issues in both projects, target and source'
do
it
"applies quick actions"
do
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issue
.
reload
).
to
be_closed
visit
project_issue_path
(
target_project
,
issue
)
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'1.0'
visit
project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_content
'Closed'
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
expect
(
page
).
to
have_content
'1.0'
end
end
context
'applies multiple commands with move command in the end'
do
before
do
add_note
(
"/label ~
#{
bug
.
title
}
~
#{
wontfix
.
title
}
\n\n
/milestone %
\"
#{
milestone
.
title
}
\"\n\n
/move
#{
target_project
.
full_path
}
"
)
end
it_behaves_like
'applies the commands to issues in both projects, target and source'
end
context
'applies multiple commands with move command in the begining'
do
before
do
add_note
(
"/move
#{
target_project
.
full_path
}
\n\n
/label ~
#{
bug
.
title
}
~
#{
wontfix
.
title
}
\n\n
/milestone %
\"
#{
milestone
.
title
}
\"
"
)
end
it_behaves_like
'applies the commands to issues in both projects, target and source'
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