Files
openfoodnetwork/spec/services/mail_configuration_spec.rb
Matt-Yorkley 3dc3581e6b Ensure Mail configs are applied when the app starts
Previously we only set these part-way through deployment, so the values could be out of sync between our ENV vars and Spree::Config (which itself is a mix of both cached values and database-persisted values).
2021-05-23 23:05:16 +01:00

33 lines
1.3 KiB
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe MailConfiguration do
describe 'apply!' do
before do
allow(Spree::Core::MailSettings).to receive(:init) { true }
end
it 'sets config entries in the Spree Config' do
allow(Spree::Config).to receive(:[]=)
described_class.apply!
expect(Spree::Config).to have_received(:[]=).with(:mail_host, "example.com")
expect(Spree::Config).to have_received(:[]=).with(:mail_domain, "example.com")
expect(Spree::Config).to have_received(:[]=).with(:mail_port, "25")
expect(Spree::Config).to have_received(:[]=).with(:mail_auth_type, "login")
expect(Spree::Config).to have_received(:[]=).with(:smtp_username, "ofn")
expect(Spree::Config).to have_received(:[]=).with(:smtp_password, "f00d")
expect(Spree::Config).to have_received(:[]=).with(:secure_connection_type, "None")
expect(Spree::Config).to have_received(:[]=).with(:mails_from, "no-reply@example.com")
expect(Spree::Config).to have_received(:[]=).with(:mail_bcc, "")
expect(Spree::Config).to have_received(:[]=).with(:intercept_email, "")
end
it 'initializes the mail settings' do
described_class.apply!
expect(Spree::Core::MailSettings).to have_received(:init)
end
end
end