Skip to content

Commit

Permalink
[BUG] Display profile update flashes in chosen language
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Reis committed Feb 21, 2017
1 parent b052cbe commit 27d2b2e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 15 additions & 0 deletions spec/features/user_visits_profile_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 27d2b2e

Please sign in to comment.