assert_redirected_to :action => :terms, :referer => "/user/#{ERB::Util.u(user.display_name)}/account"
end
+ def test_terms_not_logged_in
+ get user_terms_path
+
+ assert_redirected_to login_path(:referer => "/user/terms")
+ end
+
def test_go_public
user = create(:user, :data_public => false)
session_for(user)
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 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