Add interstitial for Terms of Service updates (#34527)

This commit is contained in:
Claire 2025-05-16 16:03:05 +02:00 committed by GitHub
parent c4f47adb49
commit 8cc5084ca1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 72 additions and 4 deletions

View file

@ -14,9 +14,10 @@ RSpec.describe Admin::DistributeTermsOfServiceNotificationWorker do
context 'with valid terms' do
let(:terms) { Fabricate(:terms_of_service) }
let!(:user) { Fabricate :user, confirmed_at: 3.days.ago }
let!(:user) { Fabricate(:user, confirmed_at: 3.days.ago) }
let!(:old_user) { Fabricate(:user, confirmed_at: 2.years.ago, current_sign_in_at: 2.years.ago) }
it 'sends the terms update via email', :inline_jobs do
it 'sends the terms update via email and change the old user to require an interstitial', :inline_jobs do
emails = capture_emails { worker.perform(terms.id) }
expect(emails.size)
@ -26,6 +27,9 @@ RSpec.describe Admin::DistributeTermsOfServiceNotificationWorker do
to: [user.email],
subject: I18n.t('user_mailer.terms_of_service_changed.subject')
)
expect(user.reload.require_tos_interstitial?).to be false
expect(old_user.reload.require_tos_interstitial?).to be true
end
end
end