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
8e4e294a
Commit
8e4e294a
authored
Aug 15, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename from/to params to from_list_id/to_list_id
parent
01b9744d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
17 deletions
+18
-17
app/controllers/projects/board_issues_controller.rb
app/controllers/projects/board_issues_controller.rb
+1
-1
app/services/boards/issues/move_service.rb
app/services/boards/issues/move_service.rb
+2
-2
spec/controllers/projects/board_issues_controller_spec.rb
spec/controllers/projects/board_issues_controller_spec.rb
+8
-7
spec/services/boards/issues/move_service_spec.rb
spec/services/boards/issues/move_service_spec.rb
+7
-7
No files found.
app/controllers/projects/board_issues_controller.rb
View file @
8e4e294a
...
...
@@ -43,7 +43,7 @@ class Projects::BoardIssuesController < Projects::ApplicationController
end
def
move_params
params
.
require
(
:issue
).
permit
(
:from
,
:to
).
merge
(
id:
params
[
:id
]
)
params
.
permit
(
:id
,
:from_list_id
,
:to_list_id
)
end
def
record_not_found
(
exception
)
...
...
app/services/boards/issues/move_service.rb
View file @
8e4e294a
...
...
@@ -23,11 +23,11 @@ module Boards
end
def
moving_from
@moving_from
||=
board
.
lists
.
find_by
(
id:
params
[
:from
])
@moving_from
||=
board
.
lists
.
find_by
(
id:
params
[
:from
_list_id
])
end
def
moving_to
@moving_to
||=
board
.
lists
.
find_by
(
id:
params
[
:to
])
@moving_to
||=
board
.
lists
.
find_by
(
id:
params
[
:to
_list_id
])
end
def
close_service
...
...
spec/controllers/projects/board_issues_controller_spec.rb
View file @
8e4e294a
...
...
@@ -64,13 +64,13 @@ describe Projects::BoardIssuesController do
context
'with valid params'
do
it
'returns a successful 200 response'
do
move
user:
user
,
issue:
issue
,
from
:
list1
.
id
,
to
:
list2
.
id
move
user:
user
,
issue:
issue
,
from
_list_id:
list1
.
id
,
to_list_id
:
list2
.
id
expect
(
response
).
to
have_http_status
(
200
)
end
it
'moves issue to the desired list'
do
move
user:
user
,
issue:
issue
,
from
:
list1
.
id
,
to
:
list2
.
id
move
user:
user
,
issue:
issue
,
from
_list_id:
list1
.
id
,
to_list_id
:
list2
.
id
expect
(
issue
.
reload
.
labels
).
to
contain_exactly
(
development
)
end
...
...
@@ -78,13 +78,13 @@ describe Projects::BoardIssuesController do
context
'with invalid params'
do
it
'returns a unprocessable entity 422 response for invalid lists'
do
move
user:
user
,
issue:
issue
,
from
:
nil
,
to
:
nil
move
user:
user
,
issue:
issue
,
from
_list_id:
nil
,
to_list_id
:
nil
expect
(
response
).
to
have_http_status
(
422
)
end
it
'returns a not found 404 response for invalid issue id'
do
move
user:
user
,
issue:
999
,
from
:
list1
.
id
,
to
:
list2
.
id
move
user:
user
,
issue:
999
,
from
_list_id:
list1
.
id
,
to_list_id
:
list2
.
id
expect
(
response
).
to
have_http_status
(
404
)
end
...
...
@@ -98,19 +98,20 @@ describe Projects::BoardIssuesController do
end
it
'returns a successful 403 response'
do
move
user:
guest
,
issue:
issue
,
from
:
list1
.
id
,
to
:
list2
.
id
move
user:
guest
,
issue:
issue
,
from
_list_id:
list1
.
id
,
to_list_id
:
list2
.
id
expect
(
response
).
to
have_http_status
(
403
)
end
end
def
move
(
user
:,
issue
:,
from
:,
to
:)
def
move
(
user
:,
issue
:,
from
_list_id
:,
to_list_id
:)
sign_in
(
user
)
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
issue
.
to_param
,
issue:
{
from:
from
,
to:
to
},
from_list_id:
from_list_id
,
to_list_id:
to_list_id
,
format: :json
end
end
...
...
spec/services/boards/issues/move_service_spec.rb
View file @
8e4e294a
...
...
@@ -22,7 +22,7 @@ describe Boards::Issues::MoveService, services: true do
context
'when moving from backlog'
do
it
'adds the label of the list it goes to'
do
issue
=
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
])
params
=
{
id:
issue
.
iid
,
from
:
backlog
.
id
,
to
:
list1
.
id
}
params
=
{
id:
issue
.
iid
,
from
_list_id:
backlog
.
id
,
to_list_id
:
list1
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
...
...
@@ -33,7 +33,7 @@ describe Boards::Issues::MoveService, services: true do
context
'when moving to backlog'
do
it
'removes all list-labels'
do
issue
=
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
,
testing
])
params
=
{
id:
issue
.
iid
,
from
:
list1
.
id
,
to
:
backlog
.
id
}
params
=
{
id:
issue
.
iid
,
from
_list_id:
list1
.
id
,
to_list_id
:
backlog
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
...
...
@@ -44,7 +44,7 @@ describe Boards::Issues::MoveService, services: true do
context
'when moving from backlog to done'
do
it
'closes the issue'
do
issue
=
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
])
params
=
{
id:
issue
.
iid
,
from
:
backlog
.
id
,
to
:
done
.
id
}
params
=
{
id:
issue
.
iid
,
from
_list_id:
backlog
.
id
,
to_list_id
:
done
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
issue
.
reload
...
...
@@ -56,7 +56,7 @@ describe Boards::Issues::MoveService, services: true do
context
'when moving an issue between lists'
do
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
])
}
let
(
:params
)
{
{
id:
issue
.
iid
,
from
:
list1
.
id
,
to
:
list2
.
id
}
}
let
(
:params
)
{
{
id:
issue
.
iid
,
from
_list_id:
list1
.
id
,
to_list_id
:
list2
.
id
}
}
it
'delegates the label changes to Issues::UpdateService'
do
expect_any_instance_of
(
Issues
::
UpdateService
).
to
receive
(
:execute
).
with
(
issue
).
once
...
...
@@ -73,7 +73,7 @@ describe Boards::Issues::MoveService, services: true do
context
'when moving to done'
do
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
,
testing
])
}
let
(
:params
)
{
{
id:
issue
.
iid
,
from
:
list2
.
id
,
to
:
done
.
id
}
}
let
(
:params
)
{
{
id:
issue
.
iid
,
from
_list_id:
list2
.
id
,
to_list_id
:
done
.
id
}
}
it
'delegates the close proceedings to Issues::CloseService'
do
expect_any_instance_of
(
Issues
::
CloseService
).
to
receive
(
:execute
).
with
(
issue
).
once
...
...
@@ -92,7 +92,7 @@ describe Boards::Issues::MoveService, services: true do
context
'when moving from done'
do
let
(
:issue
)
{
create
(
:labeled_issue
,
:closed
,
project:
project
,
labels:
[
bug
])
}
let
(
:params
)
{
{
id:
issue
.
iid
,
from
:
done
.
id
,
to
:
list2
.
id
}
}
let
(
:params
)
{
{
id:
issue
.
iid
,
from
_list_id:
done
.
id
,
to_list_id
:
list2
.
id
}
}
it
'delegates the re-open proceedings to Issues::ReopenService'
do
expect_any_instance_of
(
Issues
::
ReopenService
).
to
receive
(
:execute
).
with
(
issue
).
once
...
...
@@ -112,7 +112,7 @@ describe Boards::Issues::MoveService, services: true do
context
'when moving from done to backlog'
do
it
'reopens the issue'
do
issue
=
create
(
:labeled_issue
,
:closed
,
project:
project
,
labels:
[
bug
])
params
=
{
id:
issue
.
iid
,
from
:
done
.
id
,
to
:
backlog
.
id
}
params
=
{
id:
issue
.
iid
,
from
_list_id:
done
.
id
,
to_list_id
:
backlog
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
issue
.
reload
...
...
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