From a60e7f4124df8e8a4c3883c11daaa333008a58dd Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Tue, 19 Aug 2025 20:56:07 +0200 Subject: [PATCH] Fix mailer specs --- spec/jobs/users/mailer_sending_job_spec.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/jobs/users/mailer_sending_job_spec.rb b/spec/jobs/users/mailer_sending_job_spec.rb index f4ce4faa..ba4b1de9 100644 --- a/spec/jobs/users/mailer_sending_job_spec.rb +++ b/spec/jobs/users/mailer_sending_job_spec.rb @@ -6,6 +6,7 @@ RSpec.describe Users::MailerSendingJob, type: :job do before do allow(UsersMailer).to receive(:with).and_return(UsersMailer) + allow(DawarichSettings).to receive(:self_hosted?).and_return(false) end describe '#perform' do @@ -59,12 +60,11 @@ RSpec.describe Users::MailerSendingJob, type: :job do end context 'with active user' do - let(:active_user) { create(:user) } + let(:active_user) { create(:user).tap { |u| u.update!(status: :active) } } it 'skips sending trial_expires_soon email' do expect(UsersMailer).not_to receive(:with) expect(UsersMailer).not_to receive(:trial_expires_soon) - expect(Rails.logger).to receive(:info).with("Skipping trial_expires_soon email for user #{active_user.id} - user is already subscribed") described_class.perform_now(active_user.id, 'trial_expires_soon') end @@ -83,12 +83,11 @@ RSpec.describe Users::MailerSendingJob, type: :job do end context 'with active user' do - let(:active_user) { create(:user) } + let(:active_user) { create(:user).tap { |u| u.update!(status: :active) } } it 'skips sending trial_expired email' do expect(UsersMailer).not_to receive(:with) expect(UsersMailer).not_to receive(:trial_expired) - expect(Rails.logger).to receive(:info).with("Skipping trial_expired email for user #{active_user.id} - user is already subscribed") described_class.perform_now(active_user.id, 'trial_expired') end