mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Requested changes
This commit is contained in:
@@ -13,19 +13,6 @@ module ReportsHelper
|
||||
expect(page).to have_button "Go", disabled: false
|
||||
end
|
||||
|
||||
def run_failed_report(report)
|
||||
click_on "Go"
|
||||
|
||||
allow(report).to receive(:new).and_raise(StandardError, 'Provoked error for testing')
|
||||
perform_enqueued_jobs(only: ReportJob)
|
||||
|
||||
expect(page).not_to have_selector ".loading"
|
||||
expect(page).to have_button "Go", disabled: false
|
||||
expect(page).to have_content 'This report failed. It may be too big to process. ' \
|
||||
'We will look into it but please let us know ' \
|
||||
'if the problem persists.'
|
||||
end
|
||||
|
||||
def generate_report
|
||||
run_report
|
||||
click_on "Download Report"
|
||||
|
||||
@@ -352,7 +352,24 @@ RSpec.describe '
|
||||
visit admin_reports_path
|
||||
|
||||
click_link 'All products'
|
||||
run_failed_report(Reporting::Reports::ProductsAndInventory::AllProducts)
|
||||
report = Reporting::Reports::ProductsAndInventory::AllProducts
|
||||
|
||||
click_on "Go"
|
||||
|
||||
allow(report).to receive(:new).and_raise(StandardError, 'Provoked error for testing')
|
||||
perform_enqueued_jobs(only: ReportJob)
|
||||
|
||||
expect(page).not_to have_selector ".loading"
|
||||
expect(page).to have_button "Go", disabled: false
|
||||
expect(page).to have_content 'This report failed. It may be too big to process. ' \
|
||||
'We will look into it but please let us know ' \
|
||||
'if the problem persists.'
|
||||
|
||||
# Admin shoulb be able to make some changes and retry
|
||||
sleep(1)
|
||||
allow(report).to receive(:new).and_call_original
|
||||
|
||||
run_report
|
||||
end
|
||||
|
||||
it "shows products and inventory report" do
|
||||
|
||||
Reference in New Issue
Block a user