12314 - Fix specs for orders helper

This commit is contained in:
Ahmed Ejaz
2024-04-01 21:51:46 +05:00
parent 05f373f541
commit 7b4b7c5f45
2 changed files with 6 additions and 6 deletions

View File

@@ -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',

View File

@@ -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