From be7d44a603a6def1a2671ae1ef379aca3f06e0a2 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Thu, 16 Jun 2022 18:48:03 +0100 Subject: [PATCH] Updates payments_report_spec.rb --- spec/base_spec_helper.rb | 1 + spec/system/admin/reports/payments_report_spec.rb | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index 5b865822de..832c4da714 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -140,6 +140,7 @@ RSpec.configure do |config| config.include ActionView::Helpers::DateHelper config.include OpenFoodNetwork::PerformanceHelper config.include ActiveJob::TestHelper + config.include ReportsHelper config.include Features::DatepickerHelper, type: :system config.include DownloadsHelper, type: :system diff --git a/spec/system/admin/reports/payments_report_spec.rb b/spec/system/admin/reports/payments_report_spec.rb index 641a5a8570..b09a05952e 100644 --- a/spec/system/admin/reports/payments_report_spec.rb +++ b/spec/system/admin/reports/payments_report_spec.rb @@ -36,8 +36,6 @@ describe "Payments Reports" do context "when choosing itemised payments report type" do it "shows orders with payment state, their balance and totals" do - pending "reports overhaul spec update" - select I18n.t(:report_itemised_payment), from: "report_subtype" find("[type='submit']").click @@ -53,10 +51,10 @@ describe "Payments Reports" do expect(page.find("table.report__table tbody tr").text).to have_content([ order.payment_state, order.distributor.name, - order.item_total.to_f + other_order.item_total.to_f, - order.ship_total.to_f + other_order.ship_total.to_f, - order.outstanding_balance.to_f + other_order.outstanding_balance.to_f, - order.total.to_f + other_order.total.to_f + with_currency(order.item_total.to_f + other_order.item_total.to_f), + with_currency(order.ship_total.to_f + other_order.ship_total.to_f), + with_currency(order.outstanding_balance.to_f + other_order.outstanding_balance.to_f), + with_currency(order.total.to_f + other_order.total.to_f) ].compact.join(" ")) end end @@ -73,8 +71,6 @@ describe "Payments Reports" do } it 'shows orders with payment state, their balance and and payment totals' do - pending "reports overhaul spec update" - select I18n.t(:report_payment_totals), from: "report_subtype" find("[type='submit']").click @@ -89,6 +85,7 @@ describe "Payments Reports" do I18n.t(:report_header_outstanding_balance_price, currency: currency_symbol), ].join(" ").upcase) + pending "PR #9229 which will remove currency from the figures below" expect(page.find("table.report__table tbody tr").text).to have_content([ order.payment_state, order.distributor.name, @@ -97,7 +94,7 @@ describe "Payments Reports" do order.total.to_f + other_order.total.to_f, eft_payment.amount.to_f, paypal_payment.amount.to_f, - order.outstanding_balance.to_f + other_order.outstanding_balance.to_f, + with_currency(order.outstanding_balance + other_order.outstanding_balance), ].join(" ")) end end