assert_redirected_to login_path(:referer => "/account/edit")
# Make sure we get the page when we are logged in as the right user
assert_redirected_to login_path(:referer => "/account/edit")
# Make sure we get the page when we are logged in as the right user
# Adding external authentication should redirect to the auth provider
patch account_path, :params => { :user => user.attributes.merge(:auth_provider => "google") }
# Adding external authentication should redirect to the auth provider
patch account_path, :params => { :user => user.attributes.merge(:auth_provider => "google") }
assert_redirected_to %r{^https://accounts.google.com/o/oauth2/auth\?.*}
# Changing name to one that exists should fail
assert_redirected_to %r{^https://accounts.google.com/o/oauth2/auth\?.*}
# Changing name to one that exists should fail
# Changing name to one that doesn't exist should work
new_attributes = user.attributes.dup.merge(:display_name => "new tester")
patch account_path, :params => { :user => new_attributes }
# Changing name to one that doesn't exist should work
new_attributes = user.attributes.dup.merge(:display_name => "new tester")
patch account_path, :params => { :user => new_attributes }
assert_redirected_to login_path(:referer => "/account/edit")
# Make sure we get the page when we are logged in as the right user
assert_redirected_to login_path(:referer => "/account/edit")
# Make sure we get the page when we are logged in as the right user