mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
Improve spec: visiting order confirmation with distributor
Two cases: - the current distributor is the same than the order of the order confirmation page - the current distributor *is not* the same than the order of the order confirmation page (and has not set `hide_ofn_navigation` preference to `true`)
This commit is contained in:
committed by
David Cook
parent
348c1ff7da
commit
5279be4dc6
@@ -91,9 +91,31 @@ describe 'White label setting' do
|
||||
set_order(complete_order)
|
||||
end
|
||||
|
||||
it "hides the OFN navigation when visiting the order confirmation page" do
|
||||
visit order_path(complete_order, order_token: complete_order.token)
|
||||
expect(page).to have_no_selector ofn_navigation
|
||||
shared_examples "hides the OFN navigation when needed only for the order confirmation" do
|
||||
it "hides" do
|
||||
visit order_path(complete_order, order_token: complete_order.token)
|
||||
expect(page).to have_no_selector ofn_navigation
|
||||
end
|
||||
end
|
||||
|
||||
context "when the current distributor is the distributor of the order" do
|
||||
before do
|
||||
allow_any_instance_of(EnterprisesHelper).to receive(:current_distributor).
|
||||
and_return(distributor)
|
||||
end
|
||||
|
||||
it_behaves_like "hides the OFN navigation when needed only for the order confirmation"
|
||||
end
|
||||
|
||||
context "when the user has a current distributor that is not the distributor's order" do
|
||||
let!(:another_distributor) { create(:distributor_enterprise) }
|
||||
before do
|
||||
another_distributor.update_attribute(:preferred_hide_ofn_navigation, false)
|
||||
allow_any_instance_of(EnterprisesHelper).to receive(:current_distributor).
|
||||
and_return(another_distributor)
|
||||
end
|
||||
|
||||
it_behaves_like "hides the OFN navigation when needed only for the order confirmation"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user