Files
openfoodnetwork/spec/support/shared_examples/email_header_examples.rb
David Cook 4d6231105f Assign attribute directly instead of mocking
It's better to set a variable the same way the real code would

Co-authored-by: Maikel <maikel@email.org.au>
2025-12-29 12:18:55 +01:00

32 lines
1.0 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
order.distributor.hide_ofn_navigation = 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
order.distributor.hide_ofn_navigation = 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