OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Update more actions to respond with 303 See Other
Alexander Brandon Colesac84c7fc58cc
diff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rbindex e147051d5af..f6f2a648e11 100644--- a/app/controllers/colors_controller.rb+++ b/app/controllers/colors_controller.rb@@ -99,7 +99,7 @@ class ColorsController < ApplicationController@color.destroyflash[:notice] = I18n.t(:notice_successful_delete)- redirect_to colors_path+ redirect_to colors_path, status: :see_otherendprotecteddiff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rbindex 7dab67e53c5..3d70f09fccf 100644--- a/app/controllers/forums_controller.rb+++ b/app/controllers/forums_controller.rb@@ -120,7 +120,7 @@ class ForumsController < ApplicationControllerdef destroy@forum.destroyflash[:notice] = I18n.t(:notice_successful_delete)- redirect_to action: "index"+ redirect_to action: "index", status: :see_otherendprivatediff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rbindex e061d7bcb1d..f88309d064b 100644--- a/app/controllers/news_controller.rb+++ b/app/controllers/news_controller.rb@@ -113,7 +113,7 @@ class NewsController < ApplicationControllercall.apply_flash_message!(flash)end- redirect_to action: "index", project_id: @project+ redirect_to action: "index", project_id: @project, status: :see_otherendprivatediff --git a/modules/documents/app/controllers/documents_controller.rb b/modules/documents/app/controllers/documents_controller.rbindex 0e6e30e9340..86c27fc7b33 100644--- a/modules/documents/app/controllers/documents_controller.rb+++ b/modules/documents/app/controllers/documents_controller.rb@@ -97,7 +97,7 @@ class DocumentsController < ApplicationControllerdef destroy@document.destroy- redirect_to controller: "/documents", action: "index", project_id: @project+ redirect_to controller: "/documents", action: "index", project_id: @project, status: :see_otherendprivatediff --git a/modules/documents/spec/controllers/documents_controller_spec.rb b/modules/documents/spec/controllers/documents_controller_spec.rbindex 1b9bd1578ef..69e9ae29ffc 100644--- a/modules/documents/spec/controllers/documents_controller_spec.rb+++ b/modules/documents/spec/controllers/documents_controller_spec.rb@@ -157,12 +157,13 @@ RSpec.describe DocumentsController dodocumentend- it "deletes the document and redirect back to documents-page of the project" do+ it "deletes the document and redirects with 303 See Other" doexpect dodelete :destroy, params: { id: document.id }end.to change(Document, :count).by -1- expect(response).to redirect_to "/projects/#{project.identifier}/documents"+ expect(response).to have_http_status(:see_other)+ expect(response).to redirect_to project_documents_path(project)expect { Document.find(document.id) }.to raise_error ActiveRecord::RecordNotFoundendenddiff --git a/spec/controllers/colors_controller_spec.rb b/spec/controllers/colors_controller_spec.rbindex 6f6386763b1..8c9fcf8c7ec 100644--- a/spec/controllers/colors_controller_spec.rb+++ b/spec/controllers/colors_controller_spec.rb@@ -100,5 +100,10 @@ RSpec.describe ColorsController docolors_pathendit_behaves_like "a controller action with require_admin"++ it "redirects with 303 See Other" do+ expect(fetch).to have_http_status(:see_other)+ expect(fetch).to redirect_to(colors_path)+ endendenddiff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rbindex e866ed7249e..6fdb1caf1e2 100644--- a/spec/controllers/forums_controller_spec.rb+++ b/spec/controllers/forums_controller_spec.rb@@ -170,10 +170,11 @@ RSpec.describe ForumsController doendend- it "requests destruction and redirect" do+ it "deletes the forum and redirects with 303 See Other" doexpect(forum).to receive(:destroy)- delete :destroy, params: { project_id: project.id, id: 1 }- expect(response).to be_redirect+ delete :destroy, params: { project_id: project.identifier, id: 1 }+ expect(response).to have_http_status(:see_other)+ expect(response).to redirect_to(project_forums_path(project))endenddiff --git a/spec/controllers/news_controller_spec.rb b/spec/controllers/news_controller_spec.rbindex c4fe28496af..dd35a60bb1f 100644--- a/spec/controllers/news_controller_spec.rb+++ b/spec/controllers/news_controller_spec.rb@@ -160,9 +160,10 @@ RSpec.describe NewsController doenddescribe "#destroy" do- it "deletes the news element and redirects to the news overview page" do+ it "deletes the news item and redirects with 303 See Other" dodelete :destroy, params: { id: news.id }+ expect(response).to have_http_status(:see_other)expect(response).to redirect_to project_news_index_path(news.project)expect { news.reload }.to raise_error ActiveRecord::RecordNotFoundend