mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-04 02:31:33 +00:00
Move tests to separate file for reuse in other emails Pass on :mail symbol and obtain the mail-object using public_send() to call it with different names
32 lines
1.1 KiB
Ruby
32 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.shared_examples 'email with inactive white labelling' do |mail|
|
|
it 'always displays the OFN header with logo' do
|
|
expect(public_send(mail).body).to include(ContentConfig.url_for(:logo))
|
|
end
|
|
end
|
|
|
|
RSpec.shared_examples 'non-customer facing email with active white labelling' do |mail|
|
|
context 'when hide OFN navigation is enabled for the distributor of the order' do
|
|
before do
|
|
allow(order.distributor).to receive(:hide_ofn_navigation).and_return(true)
|
|
end
|
|
|
|
it 'still displays the OFN header with logo' do
|
|
expect(public_send(mail).body).to include(ContentConfig.url_for(:logo))
|
|
end
|
|
end
|
|
end
|
|
|
|
RSpec.shared_examples 'customer facing email with active white labelling' do |mail|
|
|
context 'when hide OFN navigation is enabled for the distributor of the order' do
|
|
before do
|
|
allow(order.distributor).to receive(:hide_ofn_navigation).and_return(true)
|
|
end
|
|
|
|
it 'does not display the OFN header and logo' do
|
|
expect(public_send(mail).body).not_to include(ContentConfig.url_for(:logo))
|
|
end
|
|
end
|
|
end
|