Redirects user back to issue boards index after deleting a board

parent 28c73326
...@@ -57,11 +57,10 @@ class Projects::BoardsController < Projects::ApplicationController ...@@ -57,11 +57,10 @@ class Projects::BoardsController < Projects::ApplicationController
def destroy def destroy
service = ::Boards::DestroyService.new(project, current_user) service = ::Boards::DestroyService.new(project, current_user)
service.execute(@board)
if service.execute(@board) respond_to do |format|
redirect_to namespace_project_boards_path(@project.namespace, @project) format.html { redirect_to namespace_project_boards_path(@project.namespace, @project) }
else
head :unprocessable_entity
end end
end end
......
...@@ -242,10 +242,10 @@ describe Projects::BoardsController do ...@@ -242,10 +242,10 @@ describe Projects::BoardsController do
let!(:board) { create(:board, project: project) } let!(:board) { create(:board, project: project) }
context 'with valid board id' do context 'with valid board id' do
it 'returns a successful 200 response' do it 'redirects to the issue boards page' do
remove_board board: board remove_board board: board
expect(response).to have_http_status(200) expect(response).to redirect_to(namespace_project_boards_path(project.namespace, project))
end end
it 'removes board from project' do it 'removes board from project' do
...@@ -278,7 +278,7 @@ describe Projects::BoardsController do ...@@ -278,7 +278,7 @@ describe Projects::BoardsController do
delete :destroy, namespace_id: project.namespace.to_param, delete :destroy, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project.to_param,
id: board.to_param, id: board.to_param,
format: :json format: :html
end end
end end
end end
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