Redirects user back to issue boards index after deleting a board

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