12890: fix product names

This commit is contained in:
Ahmed Ejaz
2024-11-24 15:24:39 +05:00
parent b1b4b10417
commit 7ca544540b

View File

@@ -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