From 5957d99812158935fa10fb3cd23c39891e5a3fe9 Mon Sep 17 00:00:00 2001 From: Konrad Date: Tue, 24 Jun 2025 17:56:03 +0200 Subject: [PATCH] Update enterprise mailer specs to check that enterprise facing emails remain unaffected by white labelling (there are no customer facing emails here) Also make use of the newly separated shared_examples --- spec/mailers/enterprise_mailer_spec.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/mailers/enterprise_mailer_spec.rb b/spec/mailers/enterprise_mailer_spec.rb index 797dd78ddc..25acda034a 100644 --- a/spec/mailers/enterprise_mailer_spec.rb +++ b/spec/mailers/enterprise_mailer_spec.rb @@ -4,9 +4,10 @@ require 'spec_helper' RSpec.describe EnterpriseMailer do let(:enterprise) { build(:enterprise, name: "Fred's Farm") } + let(:order) { build(:order_with_distributor) } describe "#welcome" do - subject(:mail) { EnterpriseMailer.welcome(enterprise) } + subject(:mail) { described_class.welcome(enterprise) } it "sends a welcome email when given an enterprise" do expect(mail.subject) @@ -16,10 +17,15 @@ RSpec.describe EnterpriseMailer do it "does not set a reply-to email" do expect(mail.reply_to).to eq nil end + + context "white labelling" do + it_behaves_like 'email with inactive white labelling', :mail + it_behaves_like 'non-customer facing email with active white labelling', :mail + end end describe "#manager_invitation" do - subject(:mail) { EnterpriseMailer.manager_invitation(enterprise, user) } + subject(:mail) { described_class.manager_invitation(enterprise, user) } let(:user) { build(:user) } it "should send a manager invitation email when given an enterprise and user" do @@ -29,5 +35,10 @@ RSpec.describe EnterpriseMailer do it "sets a reply-to of the enterprise email" do expect(mail.reply_to).to eq([enterprise.contact.email]) end + + context "white labelling" do + it_behaves_like 'email with inactive white labelling', :mail + it_behaves_like 'non-customer facing email with active white labelling', :mail + end end end