From 58912d2cec0f3a6b82e8a622663204cf30a8506d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 3 Jun 2025 04:39:05 +0300 Subject: [PATCH] Fix template rendered on profile update failure --- app/controllers/profiles_controller.rb | 2 +- test/controllers/profiles_controller_test.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index b24a9f2b3..24b49a7e5 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -43,7 +43,7 @@ class ProfilesController < ApplicationController redirect_to user_path(current_user) else flash.now[:error] = t ".failure" - render :edit + render :show end end end diff --git a/test/controllers/profiles_controller_test.rb b/test/controllers/profiles_controller_test.rb index c31a46798..9b5fb1094 100644 --- a/test/controllers/profiles_controller_test.rb +++ b/test/controllers/profiles_controller_test.rb @@ -80,4 +80,15 @@ class ProfilesControllerTest < ActionDispatch::IntegrationTest assert_select ".alert-success", /^Profile updated./ assert_select "dd", "new company" end + + def test_update_empty_social_link + user = create(:user) + session_for(user) + + put profile_path, :params => { :user => { :description => user.description, :social_links_attributes => [{ :url => "" }] } } + + assert_response :success + assert_template :show + assert_dom ".alert-danger", :text => "Couldn't update profile." + end end -- 2.39.5