From f1d81d9140460f90218e54be0639620fb8c25e42 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Wed, 30 Nov 2022 17:01:23 +0000 Subject: [PATCH] stub kernel call methods --- spec/features/bulk_upload_lettings_logs_spec.rb | 6 ++++++ spec/features/bulk_upload_sales_logs_spec.rb | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/spec/features/bulk_upload_lettings_logs_spec.rb b/spec/features/bulk_upload_lettings_logs_spec.rb index 5c2400fa1..dcbf15e56 100644 --- a/spec/features/bulk_upload_lettings_logs_spec.rb +++ b/spec/features/bulk_upload_lettings_logs_spec.rb @@ -19,6 +19,7 @@ RSpec.describe "Bulk upload lettings log" do sign_in user end + # rubocop:disable RSpec/AnyInstance context "when during crossover period" do it "shows journey with year option" do Timecop.freeze(2023, 6, 1) do @@ -44,10 +45,14 @@ RSpec.describe "Bulk upload lettings log" do expect(page).to have_content("Upload your file") click_button("Upload") + allow_any_instance_of(Forms::BulkUploadLettings::UploadYourFile).to receive(:`).and_return("not a csv") + expect(page).to have_content("Select which file to upload") attach_file "file", file_fixture("2021_22_lettings_bulk_upload.xlsx") click_button("Upload") + allow_any_instance_of(Forms::BulkUploadLettings::UploadYourFile).to receive(:`).and_return("text/csv") + expect(page).to have_content("Your file must be in CSV format") attach_file "file", file_fixture("blank_bulk_upload_sales.csv") expect { @@ -61,6 +66,7 @@ RSpec.describe "Bulk upload lettings log" do end end end + # rubocop:enable RSpec/AnyInstance context "when not it crossover period" do it "shows journey with year option" do diff --git a/spec/features/bulk_upload_sales_logs_spec.rb b/spec/features/bulk_upload_sales_logs_spec.rb index b49713b54..67356b1ee 100644 --- a/spec/features/bulk_upload_sales_logs_spec.rb +++ b/spec/features/bulk_upload_sales_logs_spec.rb @@ -19,6 +19,7 @@ RSpec.describe "Bulk upload sales log" do sign_in user end + # rubocop:disable RSpec/AnyInstance context "when during crossover period" do it "shows journey with year option" do Timecop.freeze(2023, 6, 1) do @@ -44,10 +45,14 @@ RSpec.describe "Bulk upload sales log" do expect(page).to have_content("Upload your file") click_button("Upload") + allow_any_instance_of(Forms::BulkUploadSales::UploadYourFile).to receive(:`).and_return("not a csv") + expect(page).to have_content("Select which file to upload") attach_file "file", file_fixture("2021_22_lettings_bulk_upload.xlsx") click_button("Upload") + allow_any_instance_of(Forms::BulkUploadSales::UploadYourFile).to receive(:`).and_return("text/csv") + expect(page).to have_content("Your file must be in CSV format") attach_file "file", file_fixture("blank_bulk_upload_sales.csv") expect { @@ -61,6 +66,7 @@ RSpec.describe "Bulk upload sales log" do end end end + # rubocop:enable RSpec/AnyInstance context "when not it crossover period" do it "shows journey with year option" do