(params[:user][:auth_provider] == current_user.auth_provider &&
params[:user][:auth_uid] == current_user.auth_uid)
update_user(current_user, params)
+ redirect_to user_account_url(current_user) if current_user.errors.count.zero?
else
session[:new_user_settings] = params
redirect_to auth_url(params[:user][:auth_provider], params[:user][:auth_uid])
update_user(current_user, settings)
+ flash.discard
+
session[:user_errors] = current_user.errors.as_json
redirect_to :action => "account", :display_name => current_user.display_name
set_locale(:reset => true)
if user.new_email.blank? || user.new_email == user.email
- flash.now[:notice] = t "users.account.flash update success"
+ flash[:notice] = t "users.account.flash update success"
else
user.email = user.new_email
if user.valid?
- flash.now[:notice] = t "users.account.flash update success confirm needed"
+ flash[:notice] = t "users.account.flash update success confirm needed"
begin
UserMailer.email_confirm(user, user.tokens.create).deliver_later
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 "div#errorExplanation", 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 "div#errorExplanation", false
# 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 "div#errorExplanation", 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 "div#errorExplanation", false
# 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 "div#errorExplanation", false
# 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 "div#errorExplanation", false
# Changing name to one that doesn't exist should work
new_attributes = user.attributes.dup.merge(:display_name => "new tester")
post user_account_path(user), :params => { :user => new_attributes }
+ assert_response :redirect
+ assert_redirected_to user_account_url(:display_name => "new tester")
+ get user_account_path(:display_name => "new tester")
assert_response :success
assert_template :account
assert_select "div#errorExplanation", false
post user_account_path(user), :params => { :user => user.attributes }
end
end
+ assert_response :redirect
+ assert_redirected_to user_account_url(user)
+ get user_account_path(user)
assert_response :success
assert_template :account
assert_select "div#errorExplanation", false