From 88c833ec831e95df61783962b314b1a0b8ebde2a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Mon, 27 Mar 2023 15:57:46 +0200 Subject: [PATCH] Sort array to avoid flaky spec when comparing values --- spec/services/order_cycle_form_spec.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/services/order_cycle_form_spec.rb b/spec/services/order_cycle_form_spec.rb index 562a0b2ed6..865bf7d92c 100644 --- a/spec/services/order_cycle_form_spec.rb +++ b/spec/services/order_cycle_form_spec.rb @@ -410,10 +410,9 @@ describe OrderCycleForm do ) expect{ form.save }.to change{ - order_cycle.distributor_shipping_methods.pluck(:id) - }.from([ - distributor_shipping_method, distributor_shipping_method2 - ]).to([distributor_shipping_method]) + order_cycle.distributor_shipping_methods.pluck(:id).sort + }.from([distributor_shipping_method, distributor_shipping_method2].sort) + .to([distributor_shipping_method]) end end context "can't update other distributors' shipping methods" do