From 167ce0e53ca92a368bf6d9b44c76e90f42bfd3ea Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 24 Oct 2022 15:40:35 +1100 Subject: [PATCH] Expect report rows in random order It's not deterministic which variant is shown first and therefore this spec would fail from time to time. --- .../reports/orders_and_fulfillment_spec.rb | 39 ++++++------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/spec/system/admin/reports/orders_and_fulfillment_spec.rb b/spec/system/admin/reports/orders_and_fulfillment_spec.rb index e3cac7f345..5a295120b1 100644 --- a/spec/system/admin/reports/orders_and_fulfillment_spec.rb +++ b/spec/system/admin/reports/orders_and_fulfillment_spec.rb @@ -205,34 +205,19 @@ describe "Orders And Fulfillment" do rows = find("table.report__table").all("tbody tr") table = rows.map { |r| r.all("td").map { |c| c.text.strip } } - expect(table[0]).to eq([ - "Supplier Name", - "Baked Beans", - "1g Big, S", - "3", - "0.003", - "10.0", - "30.0" - ]) + expect(table).to include [ + "Supplier Name", "Baked Beans", "1g Big, S", + "3", "0.003", "10.0", "30.0" + ] - expect(table[1]).to eq([ - "Supplier Name", - "Baked Beans", - "1g Small, S", - "7", - "0.007", - "10.0", - "70.0" - ]) - expect(table[2]).to eq([ - "", - "", - "TOTAL", - "10", - "0.01", - "", - "100.0" - ]) + expect(table).to include [ + "Supplier Name", "Baked Beans", "1g Small, S", + "7", "0.007", "10.0", "70.0" + ] + expect(table[2]).to eq [ + "", "", "TOTAL", + "10", "0.01", "", "100.0" + ] end end