Merge pull request #13662 from filipefurtad0/spec_deprecation_nil_in_sum

Catches exceptions on final_weight_volume inputs
This commit is contained in:
Maikel
2025-11-10 15:25:49 +11:00
committed by GitHub

View File

@@ -77,6 +77,23 @@ RSpec.describe Reporting::Reports::OrdersAndFulfillment::OrderCycleCustomerTotal
expect(report.rows.first.shipment_state).to eq order.shipment_state
end
end
describe "final weight volume column" do
# 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
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_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
context "loading shipping methods" do