Update endpoints to handle with board issues

parent e1dc3439
...@@ -16,6 +16,9 @@ module Projects ...@@ -16,6 +16,9 @@ module Projects
end end
def create def create
board = project.boards.find(params[:board_id])
list = board.lists.find(params[:list_id])
service = ::Boards::Issues::CreateService.new(project, current_user, issue_params) service = ::Boards::Issues::CreateService.new(project, current_user, issue_params)
issue = service.execute issue = service.execute
......
...@@ -106,6 +106,22 @@ describe Projects::Boards::IssuesController do ...@@ -106,6 +106,22 @@ describe Projects::Boards::IssuesController do
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
end end
context 'with invalid board id' do
it 'returns a not found 404 response' do
create_issue user: user, board: 999, list: list1, title: 'New issue'
expect(response).to have_http_status(404)
end
end
context 'with invalid list id' do
it 'returns a not found 404 response' do
create_issue user: user, board: board, list: 999, title: 'New issue'
expect(response).to have_http_status(404)
end
end
end end
context 'with unauthorized user' do context 'with unauthorized user' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment