X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/12c1d5e6c05813a0697724277b4d8529a1a7c240..2a5e35c7160624ba5225e065f7d726b01abb2612:/test/system/account_deletion_test.rb diff --git a/test/system/account_deletion_test.rb b/test/system/account_deletion_test.rb index 5a55c5838..ca5ef7fe8 100644 --- a/test/system/account_deletion_test.rb +++ b/test/system/account_deletion_test.rb @@ -41,4 +41,59 @@ class AccountDeletionTest < ApplicationSystemTestCase assert_content "Account Deleted" end + + test "can delete with any delay setting value if the user has no changesets" do + with_user_account_deletion_delay(10000) do + travel 1.hour do + visit edit_account_path + + click_on "Delete Account..." + + assert_no_content "cannot currently be deleted" + end + end + end + + test "can delete with delay disabled" do + with_user_account_deletion_delay(nil) do + create(:changeset, :user => @user) + + travel 1.hour do + visit edit_account_path + + click_on "Delete Account..." + + assert_no_content "cannot currently be deleted" + end + end + end + + test "can delete when last changeset is old enough" do + with_user_account_deletion_delay(10) do + create(:changeset, :user => @user, :created_at => Time.now.utc, :closed_at => Time.now.utc + 1.hour) + + travel 12.hours do + visit edit_account_path + + click_on "Delete Account..." + + assert_no_content "cannot currently be deleted" + end + end + end + + test "can't delete when last changeset isn't old enough" do + with_user_account_deletion_delay(10) do + create(:changeset, :user => @user, :created_at => Time.now.utc, :closed_at => Time.now.utc + 1.hour) + + travel 10.hours do + visit edit_account_path + + click_on "Delete Account..." + + assert_content "cannot currently be deleted" + assert_content "in about 1 hour" + end + end + end end