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

This commit is contained in:
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

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