Use reports helper to DRY

This commit is contained in:
Maikel Linke
2024-10-16 16:18:23 +11:00
parent aa2a5757ec
commit 3227922c76

View File

@@ -14,12 +14,14 @@ RSpec.describe "Customers report" do
end
run_report
rows = find("table.report__table").all("thead tr")
table = rows.map { |r| r.all("th").map { |c| c.text.strip } }
expect(table.sort).to eq([
["First Name", "Last Name", "Billing Address", "Email", "Phone", "Hub", "Hub Address",
"Shipping Method", "Total Number of Orders", "Total incl. tax ($)",
"Last completed order date"]
].sort)
expect(table_headers).to eq(
[
[
"First Name", "Last Name", "Billing Address", "Email", "Phone",
"Hub", "Hub Address", "Shipping Method", "Total Number of Orders",
"Total incl. tax ($)", "Last completed order date",
]
]
)
end
end