X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/925d12cc8176414d0f9531832862a5825783d132..2f5ec61c1d8f117c408a8d298865e26514e8fd03:/test/controllers/accounts_controller_test.rb diff --git a/test/controllers/accounts_controller_test.rb b/test/controllers/accounts_controller_test.rb index 7546c3797..131292f41 100644 --- a/test/controllers/accounts_controller_test.rb +++ b/test/controllers/accounts_controller_test.rb @@ -152,4 +152,23 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest # Make sure we have a button to "go public" assert_select "form.button_to[action='/user/go_public']", true end + + def test_destroy_allowed + user = create(:user) + session_for(user) + + delete account_path + assert_response :redirect + end + + def test_destroy_not_allowed + with_user_account_deletion_delay(24) do + user = create(:user) + create(:changeset, :user => user, :created_at => Time.now.utc) + session_for(user) + + delete account_path + assert_response :bad_request + end + end end