2
0

Avoid method that makes tokens while checking for tokens (#35815)

This commit is contained in:
Matt Jankowski
2025-08-19 02:49:34 -04:00
committed by GitHub
parent d4b2e7f771
commit ce813ad144

View File

@@ -130,14 +130,19 @@ RSpec.describe 'Settings applications page' do
describe 'Regenerating an app token' do describe 'Regenerating an app token' do
it 'updates the app token' do it 'updates the app token' do
visit settings_application_path(application) expect { visit settings_application_path(application) }
.to change(user_application_token, :first).from(be_nil).to(be_present)
expect { regenerate_token } expect { regenerate_token }
.to(change { user.token_for_app(application) }) .to(change { user_application_token.first.token })
expect(page) expect(page)
.to have_content(I18n.t('applications.token_regenerated')) .to have_content(I18n.t('applications.token_regenerated'))
end end
def user_application_token
Doorkeeper::AccessToken.where(application:).where(resource_owner_id: user)
end
def regenerate_token def regenerate_token
click_on I18n.t('applications.regenerate_token') click_on I18n.t('applications.regenerate_token')
end end