can [:make_friend, :remove_friend], Friendship
can [:new, :create, :reply, :show, :inbox, :outbox, :mark, :destroy], Message
can [:close, :reopen], Note
+ can [:show, :edit, :update], :preference
+ can [:edit, :update], :profile
can [:new, :create], Report
can [:mine, :new, :create, :edit, :update, :destroy], Trace
can [:account, :go_public], User
end
end
- def preferred_languages(reset: false)
- @preferred_languages = nil if reset
+ def preferred_languages
@preferred_languages ||= if params[:locale]
Locale.list(params[:locale])
elsif current_user
helper_method :preferred_languages
- def set_locale(reset: false)
+ def set_locale
if current_user&.languages&.empty? && !http_accept_language.user_preferred_languages.empty?
current_user.languages = http_accept_language.user_preferred_languages
current_user.save
end
- I18n.locale = Locale.available.preferred(preferred_languages(:reset => reset))
+ I18n.locale = Locale.available.preferred(preferred_languages)
response.headers["Vary"] = "Accept-Language"
response.headers["Content-Language"] = I18n.locale.to_s
# display a message about th current status of the gravatar setting
def gravatar_status_message(user)
if user.image_use_gravatar
- t "users.account.gravatar.enabled"
+ t "profiles.edit.gravatar.enabled"
else
- t "users.account.gravatar.disabled"
+ t "profiles.edit.gravatar.disabled"
end
end
end
--- /dev/null
+class PreferencesController < ApplicationController
+ layout "site"
+
+ before_action :authorize_web
+ before_action :set_locale
+
+ authorize_resource :class => false
+
+ before_action :check_database_readable
+ before_action :check_database_writable, :only => [:update]
+
+ def show; end
+
+ def edit; end
+
+ def update
+ current_user.languages = params[:user][:languages].split(",")
+
+ current_user.preferred_editor = if params[:user][:preferred_editor] == "default"
+ nil
+ else
+ params[:user][:preferred_editor]
+ end
+ if current_user.save
+ # Use a partial so that it is rendered during the next page load in the correct language.
+ flash[:notice] = { :partial => "preferences/update_success_flash" }
+ redirect_to preferences_path
+ else
+ flash[:error] = t ".failure"
+ render :edit
+ end
+ end
+end
--- /dev/null
+class ProfilesController < ApplicationController
+ layout "site"
+
+ before_action :authorize_web
+ before_action :set_locale
+
+ authorize_resource :class => false
+
+ before_action :check_database_readable
+ before_action :check_database_writable, :only => [:update]
+
+ def edit; end
+
+ def update
+ if params[:user][:description] != current_user.description
+ current_user.description = params[:user][:description]
+ current_user.description_format = "markdown"
+ end
+
+ case params[:avatar_action]
+ when "new"
+ current_user.avatar.attach(params[:user][:avatar])
+ current_user.image_use_gravatar = false
+ when "delete"
+ current_user.avatar.purge_later
+ current_user.image_use_gravatar = false
+ when "gravatar"
+ current_user.avatar.purge_later
+ current_user.image_use_gravatar = true
+ end
+
+ current_user.home_lat = params[:user][:home_lat]
+ current_user.home_lon = params[:user][:home_lon]
+
+ if current_user.save
+ flash[:notice] = t ".success"
+ redirect_to user_path(current_user)
+ else
+ flash[:error] = t ".failure"
+ render :edit
+ end
+ end
+end
user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation]
end
- if params[:user][:description] != user.description
- user.description = params[:user][:description]
- user.description_format = "markdown"
- end
-
- user.languages = params[:user][:languages].split(",")
-
- case params[:avatar_action]
- when "new"
- user.avatar.attach(params[:user][:avatar])
- user.image_use_gravatar = false
- when "delete"
- user.avatar.purge_later
- user.image_use_gravatar = false
- when "gravatar"
- user.avatar.purge_later
- user.image_use_gravatar = true
- end
-
- user.home_lat = params[:user][:home_lat]
- user.home_lon = params[:user][:home_lon]
-
- user.preferred_editor = if params[:user][:preferred_editor] == "default"
- nil
- else
- params[:user][:preferred_editor]
- end
-
if params[:user][:auth_provider].nil? || params[:user][:auth_provider].blank?
user.auth_provider = nil
user.auth_uid = nil
if user.save
session[:fingerprint] = user.fingerprint
- set_locale(:reset => true)
-
if user.new_email.blank? || user.new_email == user.email
flash[:notice] = t "users.account.flash update success"
else
before_save :encrypt_password
before_save :update_tile
after_save :spam_check
- after_save :reset_preferred_languages
def to_param
display_name
@preferred_languages ||= Locale.list(languages)
end
- def reset_preferred_languages
- @preferred_languages = nil
- end
-
def nearby(radius = Settings.nearby_radius, num = Settings.nearby_users)
if home_lon && home_lat
gc = OSM::GreatCircle.new(home_lat, home_lon)
<% end %>
<%= link_to t("users.show.my profile"), user_path(current_user), :class => "dropdown-item" %>
<%= link_to t("users.show.my settings"), { :controller => "users", :action => "account", :display_name => current_user.display_name }, { :class => "dropdown-item" } %>
+ <%= link_to t("users.show.my_preferences"), preferences_path, :class => "dropdown-item" %>
<div class="dropdown-divider"></div>
<%= yield :greeting %>
<%= link_to t("layouts.logout"), logout_path(:referer => request.fullpath), :method => "post", :class => "geolink dropdown-item" %>
--- /dev/null
+<%= t ".message" %>
--- /dev/null
+<% content_for :heading do %>
+ <h1><%= t ".title" %></h1>
+<% end %>
+
+<%= bootstrap_form_for current_user, :url => { :action => :update } do |f| %>
+ <%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{Settings.default_editor}.name")), "default"]] + Editors::AVAILABLE_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %>
+
+ <%= f.text_field :languages %>
+
+ <%= f.primary t(".save") %>
+ <%= link_to t(".cancel"), preferences_path, :class => "btn btn-link" %>
+<% end %>
--- /dev/null
+<% content_for :heading do %>
+ <h1><%= t ".title" %></h1>
+<% end %>
+
+<dl class="row">
+ <dt class="col-sm-4"><%= t ".preferred_editor" %></dt>
+
+ <% if current_user.preferred_editor? %>
+ <dd class="col-sm-8"><%= t("editor.#{current_user.preferred_editor}.description") %></dd>
+ <% else %>
+ <dd class="col-sm-8"><%= t("editor.default", :name => t("editor.#{Settings.default_editor}.name")) %></dd>
+ <% end %>
+
+ <dt class="col-sm-4"><%= t ".preferred_languages" %></dt>
+
+ <dd class="col-sm-8">
+ <ul class="list-unstyled">
+ <% current_user.preferred_languages.each do |locale| %>
+ <li><%= locale %></li>
+ <% end %>
+ </ul>
+
+ </dd>
+</dl>
+
+<div>
+ <%= link_to t(".edit_preferences"), edit_preferences_path, :class => "btn btn-outline-primary" %>
+</div>
--- /dev/null
+<% content_for :head do %>
+ <%= javascript_include_tag "user" %>
+<% end %>
+
+<% content_for :heading do %>
+ <h1><%= t ".title" %></h1>
+<% end %>
+
+<%= bootstrap_form_for current_user, :url => { :action => :update }, :html => { :multipart => true, :autocomplete => :off } do |f| %>
+ <%= f.richtext_field :description, :cols => 80, :rows => 20 %>
+
+ <fieldset class="form-group">
+ <%= f.label t(".image") %>
+ <div class="form-row">
+ <div class="col-sm-2">
+ <%= user_image current_user %>
+ </div>
+ <div class="col-sm-10">
+ <% if current_user.avatar.attached? %>
+ <%= f.radio_button "avatar_action", "keep", :name => "avatar_action", :label => t(".keep image"), :checked => !current_user.image_use_gravatar %>
+ <% end %>
+ <% if current_user.avatar.attached? || current_user.image_use_gravatar? %>
+ <%= f.radio_button "avatar_action", "delete", :name => "avatar_action", :label => t(".delete image"), :checked => false %>
+ <% end %>
+ <% if current_user.avatar.attached? %>
+ <%= f.form_group :help => t(".image size hint"), :class => "mb-0" do %>
+ <%= f.radio_button "avatar_action", "new", :name => "avatar_action", :label => t(".replace image"), :checked => false %>
+ <%= f.file_field :avatar, :hide_label => true, :wrapper => { :class => "mb-0" } %>
+ <% end %>
+ <% else %>
+ <%= f.form_group :help => t(".image size hint"), :class => "mb-0" do %>
+ <%= f.radio_button "avatar_action", "new", :name => "avatar_action", :label => t(".new image"), :checked => false %>
+ <%= f.file_field :avatar, :hide_label => true, :wrapper => { :class => "mb-0" } %>
+ <% end %>
+ <% end %>
+ <%= f.form_group :help => link_to(t(".gravatar.what_is_gravatar"), t(".gravatar.link")) do %>
+ <%= f.radio_button "avatar_action", "gravatar", :name => "avatar_action", :label => t(".gravatar.gravatar"), :checked => current_user.image_use_gravatar %>
+ <% end %>
+ </div>
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <legend><%= t ".home location" -%></legend>
+ <div id="homerow" <% unless current_user.home_lat and current_user.home_lon %> class="nohome"<% end %>>
+ <p class="message text-muted"><%= t ".no home location" %></p>
+ <div class="form-row">
+ <%= f.text_field :home_lat, :wrapper_class => "col-sm-4", :id => "home_lat" %>
+ <%= f.text_field :home_lon, :wrapper_class => "col-sm-4", :id => "home_lon" %>
+ </div>
+ </div>
+ <div class="form-check">
+ <input class="form-check-input" type="checkbox" name="updatehome" value="1" <% unless current_user.home_lat and current_user.home_lon %> checked="checked" <% end %> id="updatehome" />
+ <label class="form-check-label" for="updatehome"><%= t ".update home location on click" %></label>
+ </div>
+ <%= tag.div "", :id => "map", :class => "content_map set_location" %>
+ </fieldset>
+
+ <%= f.primary t(".save") %>
+ <%= link_to t(".cancel"), user_path(current_user), :class => "btn btn-link" %>
+<% end %>
</span>
</div>
- <%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{Settings.default_editor}.name")), "default"]] + Editors::AVAILABLE_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %>
- <%= f.richtext_field :description, :cols => 80, :rows => 20 %>
- <%= f.text_field :languages %>
-
- <fieldset class="form-group">
- <%= f.label t(".image") %>
- <div class="form-row">
- <div class="col-sm-2">
- <%= user_image current_user %>
- </div>
- <div class="col-sm-10">
- <% if current_user.avatar.attached? %>
- <%= f.radio_button "avatar_action", "keep", :name => "avatar_action", :label => t(".keep image"), :checked => !current_user.image_use_gravatar %>
- <% end %>
- <% if current_user.avatar.attached? || current_user.image_use_gravatar? %>
- <%= f.radio_button "avatar_action", "delete", :name => "avatar_action", :label => t(".delete image"), :checked => false %>
- <% end %>
- <% if current_user.avatar.attached? %>
- <%= f.form_group :help => t(".image size hint"), :class => "mb-0" do %>
- <%= f.radio_button "avatar_action", "new", :name => "avatar_action", :label => t(".replace image"), :checked => false %>
- <%= f.file_field :avatar, :hide_label => true, :wrapper => { :class => "mb-0" } %>
- <% end %>
- <% else %>
- <%= f.form_group :help => t(".image size hint"), :class => "mb-0" do %>
- <%= f.radio_button "avatar_action", "new", :name => "avatar_action", :label => t(".new image"), :checked => false %>
- <%= f.file_field :avatar, :hide_label => true, :wrapper => { :class => "mb-0" } %>
- <% end %>
- <% end %>
- <%= f.form_group :help => link_to(t(".gravatar.what_is_gravatar"), t(".gravatar.link")) do %>
- <%= f.radio_button "avatar_action", "gravatar", :name => "avatar_action", :label => t(".gravatar.gravatar"), :checked => current_user.image_use_gravatar %>
- <% end %>
- </div>
- </div>
- </fieldset>
-
- <fieldset>
- <legend><%= t ".home location" -%></legend>
- <div id="homerow" <% unless current_user.home_lat and current_user.home_lon %> class="nohome"<% end %>>
- <p class="message text-muted"><%= t ".no home location" %></p>
- <div class="form-row">
- <%= f.text_field :home_lat, :wrapper_class => "col-sm-4", :id => "home_lat" %>
- <%= f.text_field :home_lon, :wrapper_class => "col-sm-4", :id => "home_lon" %>
- </div>
- </div>
- <div class="form-check">
- <input class="form-check-input" type="checkbox" name="updatehome" value="1" <% unless current_user.home_lat and current_user.home_lon %> checked="checked" <% end %> id="updatehome" />
- <label class="form-check-label" for="updatehome"><%= t ".update home location on click" %></label>
- </div>
- <%= tag.div "", :id => "map", :class => "content_map set_location" %>
- </fieldset>
-
<%= f.primary t(".save changes button") %>
<% end %>
<div class="user-description richtext text-break"><%= @user.description.to_html %></div>
+ <% if current_user and @user.id == current_user.id %>
+ <div class="my-3">
+ <%= link_to t(".edit_profile"), edit_profile_path, :class => "btn btn-outline-primary" %>
+ </div>
+ <% end %>
+
</div>
<% if current_user and current_user.administrator? -%>
reset: "Reset Password"
flash changed: "Your password has been changed."
flash token bad: "Did not find that token, check the URL maybe?"
+ preferences:
+ show:
+ title: My Preferences
+ preferred_editor: Preferred Editor
+ preferred_languages: Preferred Languages
+ edit_preferences: Edit Preferences
+ edit:
+ title: Edit Preferences
+ save: Update Preferences
+ cancel: Cancel
+ update:
+ failure: Couldn't update preferences.
+ update_success_flash:
+ message: Preferences updated.
+ profiles:
+ edit:
+ title: Edit Profile
+ save: Update Profile
+ cancel: Cancel
+ image: Image
+ gravatar:
+ gravatar: "Use Gravatar"
+ link: "https://wiki.openstreetmap.org/wiki/Gravatar"
+ what_is_gravatar: "What is Gravatar?"
+ disabled: "Gravatar has been disabled."
+ enabled: "Display of your Gravatar has been enabled."
+ new image: "Add an image"
+ keep image: "Keep the current image"
+ delete image: "Remove the current image"
+ replace image: "Replace the current image"
+ image size hint: "(square images at least 100x100 work best)"
+ home location: "Home Location"
+ no home location: "You have not entered your home location."
+ update home location on click: "Update home location when I click on the map?"
+ update:
+ success: Profile updated.
+ failure: Couldn't update profile.
sessions:
new:
title: "Login"
my profile: My Profile
my settings: My Settings
my comments: My Comments
+ my_preferences: My Preferences
blocks on me: Blocks on Me
blocks by me: Blocks by Me
+ edit_profile: Edit Profile
send message: Send Message
diary: Diary
edits: Edits
agreed_with_pd: "You have also declared that you consider your edits to be in the Public Domain."
link: "https://www.osmfoundation.org/wiki/License/Contributor_Terms"
link text: "what is this?"
- image: Image
- gravatar:
- gravatar: "Use Gravatar"
- link: "https://wiki.openstreetmap.org/wiki/Gravatar"
- what_is_gravatar: "What is Gravatar?"
- disabled: "Gravatar has been disabled."
- enabled: "Display of your Gravatar has been enabled."
- new image: "Add an image"
- keep image: "Keep the current image"
- delete image: "Remove the current image"
- replace image: "Replace the current image"
- image size hint: "(square images at least 100x100 work best)"
- home location: "Home Location"
- no home location: "You have not entered your home location."
- update home location on click: "Update home location when I click on the map?"
save changes button: Save Changes
make edits public button: Make all my edits public
return to profile: Return to profile
match "/user/:display_name/account" => "users#account", :via => [:get, :post], :as => "user_account"
post "/user/:display_name/set_status" => "users#set_status", :as => :set_status_user
+ resource :preferences, :only => [:show, :edit, :update]
+ resource :profile, :only => [:edit, :update]
+
# friendships
match "/user/:display_name/make_friend" => "friendships#make_friend", :via => [:get, :post], :as => "make_friend"
match "/user/:display_name/remove_friend" => "friendships#remove_friend", :via => [:get, :post], :as => "remove_friend"
--- /dev/null
+require "test_helper"
+
+class PreferencesControllerTest < ActionDispatch::IntegrationTest
+ ##
+ # test all routes which lead to this controller
+ def test_routes
+ assert_routing(
+ { :path => "/preferences", :method => :get },
+ { :controller => "preferences", :action => "show" }
+ )
+
+ assert_routing(
+ { :path => "/preferences/edit", :method => :get },
+ { :controller => "preferences", :action => "edit" }
+ )
+
+ assert_routing(
+ { :path => "/preferences", :method => :put },
+ { :controller => "preferences", :action => "update" }
+ )
+ end
+
+ def test_update_preferred_editor
+ user = create(:user, :languages => [])
+ session_for(user)
+
+ # Changing to a invalid editor should fail
+ user.preferred_editor = "unknown"
+ put preferences_path, :params => { :user => user.attributes }
+ assert_response :success
+ assert_template :edit
+ assert_select ".notice", false
+ assert_select ".error", true
+ assert_select "form > div.form-group > select#user_preferred_editor > option[selected]", false
+
+ # Changing to a valid editor should work
+ user.preferred_editor = "id"
+ put preferences_path, :params => { :user => user.attributes }
+ assert_response :redirect
+ assert_redirected_to preferences_path
+ follow_redirect!
+ assert_template :show
+ assert_select ".notice", /^Preferences updated/
+ assert_select "dd", "iD (in-browser editor)"
+
+ # Changing to the default editor should work
+ user.preferred_editor = "default"
+ put preferences_path, :params => { :user => user.attributes }
+ assert_response :redirect
+ assert_redirected_to preferences_path
+ follow_redirect!
+ assert_template :show
+ assert_select ".notice", /^Preferences updated/
+ assert_select "dd", "Default (currently iD)"
+ end
+end
--- /dev/null
+require "test_helper"
+
+class ProfilesControllerTest < ActionDispatch::IntegrationTest
+ ##
+ # test all routes which lead to this controller
+ def test_routes
+ assert_routing(
+ { :path => "/profile/edit", :method => :get },
+ { :controller => "profiles", :action => "edit" }
+ )
+
+ assert_routing(
+ { :path => "/profile", :method => :put },
+ { :controller => "profiles", :action => "update" }
+ )
+ end
+
+ def test_update
+ user = create(:user)
+ session_for(user)
+
+ # Updating the description should work
+ put profile_path, :params => { :user => { :description => "new description" } }
+ assert_response :redirect
+ assert_redirected_to user_path(user)
+ follow_redirect!
+ assert_response :success
+ assert_template :show
+ assert_select ".notice", /^Profile updated./
+ assert_select "div", "new description"
+
+ # Changing to an uploaded image should work
+ image = Rack::Test::UploadedFile.new("test/gpx/fixtures/a.gif", "image/gif")
+ put profile_path, :params => { :avatar_action => "new", :user => { :avatar => image, :description => user.description } }
+ assert_response :redirect
+ assert_redirected_to user_path(user)
+ follow_redirect!
+ assert_response :success
+ assert_template :show
+ assert_select ".notice", /^Profile updated./
+ get edit_profile_path
+ assert_select "form > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-check > input[name=avatar_action][checked][value=?]", "keep"
+
+ # Changing to a gravatar image should work
+ put profile_path, :params => { :avatar_action => "gravatar", :user => { :description => user.description } }
+ assert_response :redirect
+ assert_redirected_to user_path(user)
+ follow_redirect!
+ assert_response :success
+ assert_template :show
+ assert_select ".notice", /^Profile updated./
+ get edit_profile_path
+ assert_select "form > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-group > div.form-check > input[name=avatar_action][checked][value=?]", "gravatar"
+
+ # Removing the image should work
+ put profile_path, :params => { :avatar_action => "delete", :user => { :description => user.description } }
+ assert_response :redirect
+ assert_redirected_to user_path(user)
+ follow_redirect!
+ assert_response :success
+ assert_template :show
+ assert_select ".notice", /^Profile updated./
+ get edit_profile_path
+ assert_select "form > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-check > input[name=avatar_action][checked]", false
+ assert_select "form > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-group > div.form-check > input[name=avatar_action][checked]", false
+ end
+end
assert_template :account
assert_not_equal user.description, User.find(user.id).description
- # Updating the description should work
- user.description = "new description"
- user.preferred_editor = "default"
- post user_account_path(user), :params => { :user => user.attributes }
- assert_response :redirect
- assert_redirected_to user_account_url(user)
- get user_account_path(user)
- assert_response :success
- assert_template :account
- assert_select ".notice", /^User information updated successfully/
- assert_select "form#accountForm > div.form-group > div#user_description_container > div#user_description_content > textarea#user_description", user.description
-
- # Changing to a invalid editor should fail
- user.preferred_editor = "unknown"
- post user_account_path(user), :params => { :user => user.attributes }
- assert_response :success
- assert_template :account
- assert_select ".notice", false
- assert_select "form#accountForm > div.form-group > select#user_preferred_editor > option[selected]", false
-
- # Changing to a valid editor should work
- user.preferred_editor = "id"
- post user_account_path(user), :params => { :user => user.attributes }
- assert_response :redirect
- assert_redirected_to user_account_url(user)
- get user_account_path(user)
- assert_response :success
- assert_template :account
- assert_select ".notice", /^User information updated successfully/
- assert_select "form#accountForm > div.form-group > select#user_preferred_editor > option[selected][value=?]", "id"
-
- # Changing to the default editor should work
- user.preferred_editor = "default"
- post user_account_path(user), :params => { :user => user.attributes }
- assert_response :redirect
- assert_redirected_to user_account_url(user)
- get user_account_path(user)
- assert_response :success
- assert_template :account
- assert_select ".notice", /^User information updated successfully/
- assert_select "form#accountForm > div.form-group > select#user_preferred_editor > option[selected]", false
-
- # Changing to an uploaded image should work
- image = Rack::Test::UploadedFile.new("test/gpx/fixtures/a.gif", "image/gif")
- post user_account_path(user), :params => { :avatar_action => "new", :user => user.attributes.merge(:avatar => image) }
- assert_response :redirect
- assert_redirected_to user_account_url(user)
- get user_account_path(user)
- assert_response :success
- assert_template :account
- assert_select ".notice", /^User information updated successfully/
- assert_select "form#accountForm > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-check > input[name=avatar_action][checked][value=?]", "keep"
-
- # Changing to a gravatar image should work
- post user_account_path(user), :params => { :avatar_action => "gravatar", :user => user.attributes }
- assert_response :redirect
- assert_redirected_to user_account_url(user)
- get user_account_path(user)
- assert_response :success
- assert_template :account
- assert_select ".notice", /^User information updated successfully/
- assert_select "form#accountForm > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-group > div.form-check > input[name=avatar_action][checked][value=?]", "gravatar"
-
- # Removing the image should work
- post user_account_path(user), :params => { :avatar_action => "delete", :user => user.attributes }
- assert_response :redirect
- assert_redirected_to user_account_url(user)
- get user_account_path(user)
- assert_response :success
- assert_template :account
- assert_select ".notice", /^User information updated successfully/
- assert_select "form#accountForm > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-check > input[name=avatar_action][checked]", false
- assert_select "form#accountForm > fieldset.form-group > div.form-row > div.col-sm-10 > div.form-group > div.form-check > input[name=avatar_action][checked]", false
-
# Adding external authentication should redirect to the auth provider
post user_account_path(user), :params => { :user => user.attributes.merge(:auth_provider => "openid", :auth_uid => "gmail.com") }
assert_response :redirect
--- /dev/null
+require "application_system_test_case"
+
+class PreferencesTest < ApplicationSystemTestCase
+ def test_flash_message_shows_in_original_language
+ sign_in_as(create(:user))
+
+ visit edit_preferences_path
+ click_on "Update Preferences"
+
+ assert page.has_content?("Preferences updated")
+ end
+
+ def test_flash_message_shows_in_new_language
+ sign_in_as(create(:user))
+
+ visit edit_preferences_path
+ fill_in "Preferred Languages", :with => "fr"
+ click_on "Update Preferences"
+
+ # TODO: enable with french translation when that's available
+ # assert page.has_content?("Préférences mises à jour") # rubocop:disable Style/AsciiComments
+ end
+end