Skip to content

Commit

Permalink
remove inappropriate status tripping up turbo
Browse files Browse the repository at this point in the history
  • Loading branch information
ulferts committed Dec 3, 2024
1 parent 148c6fd commit 613cbaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/controllers/types_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/types_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']" }
Expand All @@ -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" }

Expand Down

0 comments on commit 613cbaf

Please sign in to comment.