Add stub for trending tags in user mailer spec (#29850)

pull/29863/head
Claire 2024-04-05 09:48:07 +02:00 committed by GitHub
parent 601834d746
commit 1f11aa5f04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -247,6 +247,12 @@ describe UserMailer do
describe '#welcome' do describe '#welcome' do
let(:mail) { described_class.welcome(receiver) } let(:mail) { described_class.welcome(receiver) }
before do
# This is a bit hacky and low-level but this allows stubbing trending tags
tag_ids = Fabricate.times(5, :tag).pluck(:id)
allow(Trends.tags).to receive(:query).and_return(instance_double(Trends::Query, allowed: Tag.where(id: tag_ids)))
end
it 'renders welcome mail' do it 'renders welcome mail' do
expect(mail) expect(mail)
.to be_present .to be_present