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
e9154f46
Commit
e9154f46
authored
Sep 27, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow sending label ids on board creation/update
parent
c6570947
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
14 deletions
+34
-14
ee/app/controllers/ee/boards/boards_controller.rb
ee/app/controllers/ee/boards/boards_controller.rb
+1
-1
spec/ee/spec/controllers/projects/boards_controller_spec.rb
spec/ee/spec/controllers/projects/boards_controller_spec.rb
+33
-13
No files found.
ee/app/controllers/ee/boards/boards_controller.rb
View file @
e9154f46
...
...
@@ -55,7 +55,7 @@ module EE
end
def
board_params
params
.
require
(
:board
).
permit
(
:name
,
:weight
,
:milestone_id
,
:author_id
,
:assignee_id
)
params
.
require
(
:board
).
permit
(
:name
,
:weight
,
:milestone_id
,
:author_id
,
:assignee_id
,
label_ids:
[]
)
end
def
find_board
...
...
spec/ee/spec/controllers/projects/boards_controller_spec.rb
View file @
e9154f46
...
...
@@ -38,32 +38,34 @@ describe Projects::BoardsController do
context
'with valid params'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:milestone
)
{
create
(
:milestone
)
}
let
(
:label
)
{
create
(
:label
)
}
let
(
:
valid
_params
)
do
let
(
:
create
_params
)
do
{
name:
'Backend'
,
weight:
1
,
milestone_id:
milestone
.
id
,
author_id:
user
.
id
,
assignee_id:
user
.
id
}
assignee_id:
user
.
id
,
label_ids:
[
label
.
id
]
}
end
it
'returns a successful 200 response'
do
create_board
valid
_params
create_board
create
_params
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns the created board'
do
create_board
valid
_params
create_board
create
_params
expect
(
response
).
to
match_response_schema
(
'board'
)
end
it
'valid board is created'
do
create_board
valid
_params
create_board
create
_params
expect
(
Board
.
count
).
to
eq
(
1
)
expect
(
Board
.
first
).
to
have_attributes
(
valid
_params
)
expect
(
Board
.
first
).
to
have_attributes
(
create
_params
)
end
end
...
...
@@ -108,24 +110,42 @@ describe Projects::BoardsController do
describe
'PATCH update'
do
let
(
:board
)
{
create
(
:board
,
project:
project
,
name:
'Backend'
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:milestone
)
{
create
(
:milestone
)
}
let
(
:label
)
{
create
(
:label
)
}
let
(
:update_params
)
do
{
name:
'Frontend'
,
weight:
1
,
milestone_id:
milestone
.
id
,
author_id:
user
.
id
,
assignee_id:
user
.
id
,
label_ids:
[
label
.
id
]
}
end
context
'with valid params'
do
it
'returns a successful 200 response'
do
update_board
board
:
board
,
name:
'Frontend'
update_board
board
,
update_params
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns the updated board'
do
update_board
board
:
board
,
name:
'Frontend'
update_board
board
,
update_params
expect
(
response
).
to
match_response_schema
(
'board'
)
end
it
'updates board with valid params'
do
update_board
board
,
update_params
expect
(
board
.
reload
).
to
have_attributes
(
update_params
)
end
end
context
'with invalid params'
do
it
'returns an unprocessable entity 422 response'
do
update_board
board
:
board
,
name:
nil
update_board
board
,
name:
nil
expect
(
response
).
to
have_http_status
(
422
)
end
...
...
@@ -133,7 +153,7 @@ describe Projects::BoardsController do
context
'with invalid board id'
do
it
'returns a not found 404 response'
do
update_board
board:
999
,
name:
'Frontend'
update_board
999
,
name:
nil
expect
(
response
).
to
have_http_status
(
404
)
end
...
...
@@ -146,18 +166,18 @@ describe Projects::BoardsController do
end
it
'returns a not found 404 response'
do
update_board
board
:
board
,
name:
'Backend'
update_board
board
,
update_params
expect
(
response
.
content_type
).
to
eq
'application/json'
expect
(
response
).
to
have_http_status
(
404
)
end
end
def
update_board
(
board
:,
name
:
)
def
update_board
(
board
,
update_params
)
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
board
.
to_param
,
board:
{
name:
name
}
,
board:
update_params
,
format: :json
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