BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
547d218e
Commit
547d218e
authored
Aug 01, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add endpoint to allow users to remove lists
parent
aa97c0fd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletion
+47
-1
board_lists_controller.rb
app/controllers/projects/board_lists_controller.rb
+12
-0
routes.rb
config/routes.rb
+1
-1
board_lists_controller_spec.rb
spec/controllers/projects/board_lists_controller_spec.rb
+34
-0
No files found.
app/controllers/projects/board_lists_controller.rb
View file @
547d218e
...
...
@@ -25,6 +25,18 @@ class Projects::BoardListsController < Projects::ApplicationController
end
end
def
destroy
service
=
Boards
::
Lists
::
DestroyService
.
new
(
project
,
params
)
respond_to
do
|
format
|
if
service
.
execute
format
.
json
{
head
:ok
}
else
format
.
json
{
head
:unprocessable_entity
}
end
end
end
private
def
record_not_found
(
exception
)
...
...
config/routes.rb
View file @
547d218e
...
...
@@ -857,7 +857,7 @@ Rails.application.routes.draw do
end
resource
:board
,
only:
[
:show
]
do
resources
:lists
,
only:
[
:create
,
:update
],
controller: :board_lists
resources
:lists
,
only:
[
:create
,
:update
,
:destroy
],
controller: :board_lists
end
resources
:todos
,
only:
[
:create
]
...
...
spec/controllers/projects/board_lists_controller_spec.rb
View file @
547d218e
...
...
@@ -97,5 +97,39 @@ describe Projects::BoardListsController do
end
end
end
describe
'DELETE #destroy'
do
context
'with valid list id'
do
let!
(
:planning
)
{
create
(
:list
,
board:
project
.
board
,
position:
1
)
}
it
'returns a successful 200 response'
do
delete
:destroy
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
planning
.
to_param
,
format: :json
expect
(
response
).
to
have_http_status
(
200
)
end
it
'removes list from board'
do
expect
do
delete
:destroy
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
planning
.
to_param
,
format: :json
end
.
to
change
(
project
.
board
.
lists
,
:size
).
by
(
-
1
)
end
end
context
'with invalid list id'
do
it
'returns a not found 404 response'
do
delete
:destroy
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
999
,
format: :json
expect
(
response
).
to
have_http_status
(
404
)
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