]> git.openstreetmap.org Git - rails.git/blob - test/system/account_deletion_test.rb
5a55c5838cb6bda7cb6bb4ee776e3ac53cc7e1b6
[rails.git] / test / system / account_deletion_test.rb
1 require "application_system_test_case"
2
3 class AccountDeletionTest < ApplicationSystemTestCase
4   def setup
5     @user = create(:user, :display_name => "test user")
6     sign_in_as(@user)
7   end
8
9   test "the status is deleted and the personal data removed" do
10     visit edit_account_path
11
12     click_on "Delete Account..."
13     accept_confirm do
14       click_on "Delete Account"
15     end
16
17     assert_current_path root_path
18     @user.reload
19     assert_equal "deleted", @user.status
20     assert_equal "user_#{@user.id}", @user.display_name
21   end
22
23   test "the user is signed out after deletion" do
24     visit edit_account_path
25
26     click_on "Delete Account..."
27     accept_confirm do
28       click_on "Delete Account"
29     end
30
31     assert_content "Log In"
32   end
33
34   test "the user is shown a confirmation flash message" do
35     visit edit_account_path
36
37     click_on "Delete Account..."
38     accept_confirm do
39       click_on "Delete Account"
40     end
41
42     assert_content "Account Deleted"
43   end
44 end