Merge pull request #1402 from Retrospring/bugfix/rendirect-to

Properly show validation errors in settings controllers
This commit is contained in:
Karina Kwiatek 2023-10-20 07:50:13 +02:00 committed by GitHub
commit 16071d6a86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View File

@ -19,6 +19,6 @@ class Settings::PrivacyController < ApplicationController
else
flash[:error] = t(".error")
end
redirect_to settings_privacy_path
render :edit
end
end

View File

@ -14,6 +14,6 @@ class Settings::ProfileController < ApplicationController
flash[:error] = t(".error")
end
redirect_to settings_profile_path
render :edit
end
end

View File

@ -22,7 +22,7 @@ class Settings::ThemeController < ApplicationController
else
flash[:error] = t(".error", errors: current_user.theme.errors.messages.flatten.join(" "))
end
redirect_to settings_theme_path
render :edit
end
def destroy

View File

@ -13,7 +13,7 @@ describe Settings::PrivacyController, type: :controller do
it "renders the edit template" do
subject
expect(response).to render_template("edit")
expect(response).to render_template(:edit)
end
end
end
@ -43,7 +43,7 @@ describe Settings::PrivacyController, type: :controller do
it "redirects to the privacy settings page" do
subject
expect(response).to redirect_to(:settings_privacy)
expect(response).to render_template(:edit)
end
end
end

View File

@ -37,7 +37,7 @@ describe Settings::ProfileController, type: :controller do
it "redirects to the edit_user_profile page" do
subject
expect(response).to redirect_to(:settings_profile)
expect(response).to render_template(:edit)
end
end
end

View File

@ -61,7 +61,7 @@ describe Settings::ThemeController, type: :controller do
it "renders the edit template" do
subject
expect(response).to redirect_to(:settings_theme)
expect(response).to render_template(:edit)
end
end
@ -75,7 +75,7 @@ describe Settings::ThemeController, type: :controller do
it "renders the edit template" do
subject
expect(response).to redirect_to(:settings_theme)
expect(response).to render_template(:edit)
end
end
end