diff --git a/spec/lib/reports/orders_and_fulfillment/order_cycle_customer_totals_report_spec.rb b/spec/lib/reports/orders_and_fulfillment/order_cycle_customer_totals_report_spec.rb index 97a4fd26b9..6a5de015be 100644 --- a/spec/lib/reports/orders_and_fulfillment/order_cycle_customer_totals_report_spec.rb +++ b/spec/lib/reports/orders_and_fulfillment/order_cycle_customer_totals_report_spec.rb @@ -82,20 +82,17 @@ RSpec.describe Reporting::Reports::OrdersAndFulfillment::OrderCycleCustomerTotal # related to https://github.com/openfoodfoundation/openfoodnetwork/issues/13270 # not sure how we got DEPRECATION WARNING: Rails 7.0 has deprecated Enumerable.sum # but these scenarios might be related - it "handles a nil instead of an actual value" do - order.line_items[0].update!(final_weight_volume: nil) - expect { report_table }.not_to raise_error(TypeError, "nil can't be coerced into Integer") + shared_examples "the report is successfully generated" do |test_case, type| + it "if column final_weight_volume is #{test_case}" do + order.line_items[0].update!(final_weight_volume: type) + expect(report_table.length).to eq(2) + end end - it "it handles a missing value" do - order.line_items[0].update!(final_weight_volume: "") - expect { report_table }.not_to raise_error(TypeError, "nil can't be coerced into Integer") - end - - it "handles a string input" do - order.line_items[0].update!(final_weight_volume: "a string") - expect { report_table }.not_to raise_error - end + it_behaves_like "the report is successfully generated", "nil", nil + it_behaves_like "the report is successfully generated", "an empty value", "" + it_behaves_like "the report is successfully generated", "a white space", " " + it_behaves_like "the report is successfully generated", "a string", "kilograms" end end