X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/af273f5d6ae160de0001ce1ac0c087d92a2463c6..6c1d73a509a1ac2216a704f3dc5534d573e5d7ae:/test/system/account_deletion_test.rb diff --git a/test/system/account_deletion_test.rb b/test/system/account_deletion_test.rb new file mode 100644 index 000000000..5a55c5838 --- /dev/null +++ b/test/system/account_deletion_test.rb @@ -0,0 +1,44 @@ +require "application_system_test_case" + +class AccountDeletionTest < ApplicationSystemTestCase + def setup + @user = create(:user, :display_name => "test user") + sign_in_as(@user) + end + + test "the status is deleted and the personal data removed" do + visit edit_account_path + + click_on "Delete Account..." + accept_confirm do + click_on "Delete Account" + end + + assert_current_path root_path + @user.reload + assert_equal "deleted", @user.status + assert_equal "user_#{@user.id}", @user.display_name + end + + test "the user is signed out after deletion" do + visit edit_account_path + + click_on "Delete Account..." + accept_confirm do + click_on "Delete Account" + end + + assert_content "Log In" + end + + test "the user is shown a confirmation flash message" do + visit edit_account_path + + click_on "Delete Account..." + accept_confirm do + click_on "Delete Account" + end + + assert_content "Account Deleted" + end +end