mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add common whitespace to spec
This commit is contained in:
@@ -98,11 +98,13 @@ describe OrderCyclesHelper, type: :helper do
|
||||
let(:hub2) { create(:distributor_enterprise, name: 'hub2') }
|
||||
let(:supplier){ create(:supplier_enterprise, name: 'supplier') }
|
||||
let(:coordinator){ create(:distributor_enterprise, name: 'coordinator') }
|
||||
|
||||
before do
|
||||
allow(oc).to receive(:coordinator).and_return coordinator
|
||||
allow(oc).to receive(:suppliers).and_return [supplier]
|
||||
allow(oc).to receive(:distributors).and_return [hub1, hub2]
|
||||
end
|
||||
|
||||
context 'current user is a coordinator' do
|
||||
before do
|
||||
allow(helper).to receive(:spree_current_user).and_return coordinator.owner
|
||||
@@ -112,18 +114,22 @@ describe OrderCyclesHelper, type: :helper do
|
||||
expect(helper.distributors_with_editable_shipping_and_payment_methods(oc)).to eq [hub1, hub2]
|
||||
end
|
||||
end
|
||||
|
||||
context 'current user is a producer' do
|
||||
before do
|
||||
allow(helper).to receive(:spree_current_user).and_return supplier.owner
|
||||
end
|
||||
|
||||
it "doesn't return any distributors" do
|
||||
expect(helper.distributors_with_editable_shipping_and_payment_methods(oc)).to eq []
|
||||
end
|
||||
end
|
||||
|
||||
context 'current user is a hub' do
|
||||
before do
|
||||
allow(helper).to receive(:spree_current_user).and_return hub1.owner
|
||||
end
|
||||
|
||||
it "returns only the hubs of the current user" do
|
||||
expect(helper.distributors_with_editable_shipping_and_payment_methods(oc)).to eq [hub1]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user