From 3c55311d08d02ae4a97e1abc0303234c223223b3 Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Tue, 17 Dec 2024 14:31:54 +0100 Subject: [PATCH] Update after merge --- test/controllers/passwords_controller_test.rb | 2 +- test/integration/recoverable_test.rb | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test/controllers/passwords_controller_test.rb b/test/controllers/passwords_controller_test.rb index f2d5c1dd0e..85b70befb0 100644 --- a/test/controllers/passwords_controller_test.rb +++ b/test/controllers/passwords_controller_test.rb @@ -32,7 +32,7 @@ def put_update_with_params end test '#edit redirect if reset_password_token has expired' do - @user.reset_password_sent_at = @user.class.reset_password_within - 1.second + @user.reset_password_sent_at = Time.now - @user.class.reset_password_within - 1.second @user.save get :edit, params: { reset_password_token: @raw } assert_equal "This password recovery link has expired, please request a new one.", flash[:alert] diff --git a/test/integration/recoverable_test.rb b/test/integration/recoverable_test.rb index c391b0b2eb..492d46a1d1 100644 --- a/test/integration/recoverable_test.rb +++ b/test/integration/recoverable_test.rb @@ -154,13 +154,12 @@ def reset_password(options = {}, &block) test 'not authenticated user with invalid reset password token should not be able to change their password' do user = create_user - reset_password reset_password_token: 'invalid_reset_password' + get edit_user_password_path(reset_password_token: 'invalid_reset_password') - assert_response :success - assert_current_url '/users/password' - assert_have_selector '#error_explanation' - assert_contain %r{Reset password token(.*)invalid} - assert_not user.reload.valid_password?('987654321') + assert_response :redirect + assert_redirected_to "/users/password/new" + follow_redirect! + assert_contain 'This password recovery link is invalid, please request a new one.' end test 'not authenticated user with valid reset password token but invalid password should not be able to change their password' do