Update devise to version 5.0 (#37419)

This commit is contained in:
Matt Jankowski
2026-02-05 06:05:32 -05:00
committed by GitHub
parent 9cd94168b3
commit f652c54c33
6 changed files with 18 additions and 16 deletions

View File

@@ -70,7 +70,7 @@ RSpec.describe Auth::SessionsController do
end
it 'shows a login error and does not log the user in' do
expect(flash[:alert]).to match I18n.t('devise.failure.invalid', authentication_keys: I18n.t('activerecord.attributes.user.email'))
expect(flash[:alert]).to match(/#{failure_message_invalid_email}/i)
expect(controller.current_user).to be_nil
end
@@ -163,7 +163,7 @@ RSpec.describe Auth::SessionsController do
end
it 'shows a login error and does not log the user in' do
expect(flash[:alert]).to match I18n.t('devise.failure.invalid', authentication_keys: I18n.t('activerecord.attributes.user.email'))
expect(flash[:alert]).to match(/#{failure_message_invalid_email}/i)
expect(controller.current_user).to be_nil
end
@@ -420,5 +420,9 @@ RSpec.describe Auth::SessionsController do
end
end
end
def failure_message_invalid_email
I18n.t('devise.failure.invalid', authentication_keys: I18n.t('activerecord.attributes.user.email'))
end
end
end

View File

@@ -25,7 +25,7 @@ RSpec.describe 'Log in' do
it 'A invalid email and password user is not able to log in' do
fill_in_auth_details('invalid_email', 'invalid_password')
expect(subject).to have_css('.flash-message', text: failure_message('invalid'))
expect(subject).to have_css('.flash-message', text: /#{failure_message_invalid}/i)
end
context 'when confirmed at is nil' do
@@ -38,8 +38,8 @@ RSpec.describe 'Log in' do
end
end
def failure_message(message)
def failure_message_invalid
keys = User.authentication_keys.map { |key| User.human_attribute_name(key) }
I18n.t("devise.failure.#{message}", authentication_keys: keys.join('support.array.words_connector'))
I18n.t('devise.failure.invalid', authentication_keys: keys.join('support.array.words_connector'))
end
end