diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb index 8534e3843904..c46d8cb09eee 100644 --- a/app/controllers/types_controller.rb +++ b/app/controllers/types_controller.rb @@ -88,7 +88,7 @@ def update call.on_failure do |result| flash[:error] = result.errors.full_messages.join("\n") - render_edit_tab(@type) + render_edit_tab(@type, status: :unprocessable_entity) end end end @@ -139,12 +139,12 @@ def redirect_to_type_tab_path(type, notice) notice:) end - def render_edit_tab(type) + def render_edit_tab(type, status: :ok) @tab = params[:tab] @projects = Project.all @type = type - render action: :edit, status: :unprocessable_entity + render action: :edit, status: end def show_local_breadcrumb diff --git a/spec/controllers/types_controller_spec.rb b/spec/controllers/types_controller_spec.rb index 5130db3b52b7..f1064418e1ab 100644 --- a/spec/controllers/types_controller_spec.rb +++ b/spec/controllers/types_controller_spec.rb @@ -214,7 +214,7 @@ get "edit", params: { id: type.id, tab: :settings } end - it { expect(response).to have_http_status(:unprocessable_entity) } + it { expect(response).to have_http_status(:ok) } it { expect(response).to render_template "edit" } it { expect(response).to render_template "types/form/_settings" } it { expect(response.body).to have_css "input[@name='type[name]'][@value='My type']" } @@ -233,7 +233,7 @@ get "edit", params: { id: type.id, tab: :projects } end - it { expect(response).to have_http_status(:unprocessable_entity) } + it { expect(response).to have_http_status(:ok) } it { expect(response).to render_template "edit" } it { expect(response).to render_template "types/form/_projects" }