From 7ca544540b69c50b19dfeae9f335d806bcb01d79 Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Sun, 24 Nov 2024 15:24:39 +0500 Subject: [PATCH] 12890: fix product names --- .../admin/reports/pay_your_suppliers_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/system/admin/reports/pay_your_suppliers_spec.rb b/spec/system/admin/reports/pay_your_suppliers_spec.rb index a7b7ac9966..b22a094c5d 100644 --- a/spec/system/admin/reports/pay_your_suppliers_spec.rb +++ b/spec/system/admin/reports/pay_your_suppliers_spec.rb @@ -34,6 +34,8 @@ RSpec.describe "Pay Your Suppliers Report" do before do login_as owner visit admin_reports_path + + update_line_items_product_names end context "on Reports page" do @@ -138,4 +140,18 @@ RSpec.describe "Pay Your Suppliers Report" do expect(lines.last).to have_content("TOTAL 50.0 50.0 0.0 0.0 0.0 50.0") end end + + def update_line_items_product_names + n = 1 + update_product_name_proc = proc do |order| + order.line_items.each do |line_item| + product = line_item.variant.product + product.update!(name: "Product##{n}") + n += 1 + end + end + + update_product_name_proc.call(order1) + update_product_name_proc.call(order2) + end end