mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
12314 - Fix specs for orders helper
This commit is contained in:
@@ -18,7 +18,7 @@ module Spree
|
||||
def changeable_orders
|
||||
# Only returns open order for the current user + shop + oc combo
|
||||
@changeable_orders ||= if spree_current_user &&
|
||||
current_distributor&.allow_order_changes? && current_order_cycle
|
||||
current_order_cycle && current_distributor&.allow_order_changes?
|
||||
|
||||
Spree::Order.complete.where(
|
||||
state: 'complete',
|
||||
|
||||
@@ -31,6 +31,11 @@ describe Spree::OrdersHelper, type: :helper do
|
||||
before { allow(current_distributor).to receive(:allow_order_changes?) { false } }
|
||||
it { expect(helper.changeable_orders).to eq [] }
|
||||
end
|
||||
|
||||
context "when a current_distributor is not defined" do
|
||||
let(:current_distributor) { nil }
|
||||
it { expect(helper.changeable_orders).to eq [] }
|
||||
end
|
||||
end
|
||||
|
||||
context "when a current_order_cycle is not defined" do
|
||||
@@ -38,11 +43,6 @@ describe Spree::OrdersHelper, type: :helper do
|
||||
it { expect(helper.changeable_orders).to eq [] }
|
||||
end
|
||||
end
|
||||
|
||||
context "when a current_distributor is not defined" do
|
||||
let(:current_distributor) { nil }
|
||||
it { expect(helper.changeable_orders).to eq [] }
|
||||
end
|
||||
end
|
||||
|
||||
context "when spree_current_user is not defined" do
|
||||
|
||||
Reference in New Issue
Block a user