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
This commit is contained in:
Konrad
2025-06-24 17:56:03 +02:00
parent 89453ec758
commit 5957d99812

View File

@@ -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