diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 9c2ac37d..42b524dc 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -57,7 +57,7 @@ def update respond_to do |format| if @profile.context_update(profile_params) update_locale(new_language_id) unless new_language_id == old_language_id - format.html { redirect_to redirect_path, notice: "Profile was successfully updated." } + format.html { redirect_to redirect_path, notice: I18n.t("profile_page.updated") } format.json { render :show, status: :ok, location: @profile } else format.html { render :show } diff --git a/config/locales/en.yml b/config/locales/en.yml index e80e14aa..a0f10b28 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -133,6 +133,7 @@ en: # These are backward because of the question phrasing: opt_out_false: "Yes" opt_out_true: "No" + updated: "Profile was successfully updated." programs_form: parent_type: "Select Program Type..." program_name: "Program Name" diff --git a/config/locales/es.yml b/config/locales/es.yml index d7d6aaa5..868cf805 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -133,6 +133,7 @@ es: # These are backward because of the question phrasing: opt_out_false: "Si" opt_out_true: "No" + updated: "El perfil se actualizó correctamente." programs_form: parent_type: "Seleccione el tipo de programa..." program_name: "Nombre del programa" diff --git a/spec/features/user_visits_profile_page_spec.rb b/spec/features/user_visits_profile_page_spec.rb index d03c9290..3cb42388 100644 --- a/spec/features/user_visits_profile_page_spec.rb +++ b/spec/features/user_visits_profile_page_spec.rb @@ -47,6 +47,21 @@ expect(@user.profile.language.name).to eq("English") end + scenario "can change language preference" do + visit profile_path + select("Spanish", from: "profile_language_id") + click_button "Save" + + expect(page).to have_content "El perfil se actualizó correctamente." + expect(page).to have_content "Idioma de preferencia" + + select("English", from: "profile_language_id") + click_button "Guardar" + + expect(page).to have_content "Profile was successfully updated." + expect(page).to have_content "Preferred Language" + end + scenario "can view completed courses" do # visit courses_completed_path end