|
|
|
|
@ -21,8 +21,12 @@ RSpec.describe "Bulk upload lettings log" do
|
|
|
|
|
|
|
|
|
|
# rubocop:disable RSpec/AnyInstance |
|
|
|
|
context "when during crossover period" do |
|
|
|
|
before do |
|
|
|
|
allow(FeatureToggle).to receive(:force_crossover?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "shows journey with year option" do |
|
|
|
|
Timecop.freeze(2022, 6, 1) do |
|
|
|
|
Timecop.freeze(2023, 6, 1) do |
|
|
|
|
visit("/lettings-logs") |
|
|
|
|
expect(page).to have_link("Upload lettings logs in bulk") |
|
|
|
|
click_link("Upload lettings logs in bulk") |
|
|
|
|
@ -31,37 +35,27 @@ RSpec.describe "Bulk upload lettings log" do
|
|
|
|
|
click_button("Continue") |
|
|
|
|
|
|
|
|
|
expect(page).to have_content("You must select a collection period to upload for") |
|
|
|
|
choose("2022/2023") |
|
|
|
|
choose("2023/2024") |
|
|
|
|
click_button("Continue") |
|
|
|
|
|
|
|
|
|
click_link("Back") |
|
|
|
|
|
|
|
|
|
expect(page.find_field("form-year-2022-field")).to be_checked |
|
|
|
|
click_button("Continue") |
|
|
|
|
|
|
|
|
|
expect(page).to have_content("Upload lettings logs in bulk (2022/23)") |
|
|
|
|
click_button("Continue") |
|
|
|
|
|
|
|
|
|
expect(page).to have_content("What is the needs type?") |
|
|
|
|
expect(page.find_field("form-year-2023-field")).to be_checked |
|
|
|
|
click_button("Continue") |
|
|
|
|
|
|
|
|
|
expect(page).to have_content("You must answer needs type") |
|
|
|
|
choose("General needs") |
|
|
|
|
expect(page).to have_content("Upload lettings logs in bulk (2023/24)") |
|
|
|
|
click_button("Continue") |
|
|
|
|
|
|
|
|
|
click_link("Back") |
|
|
|
|
expect(page).not_to have_content("What is the needs type?") |
|
|
|
|
|
|
|
|
|
expect(page.find_field("form-needstype-1-field")).to be_checked |
|
|
|
|
click_button("Continue") |
|
|
|
|
|
|
|
|
|
expect(page).to have_content("Upload lettings logs in bulk (2022/23)") |
|
|
|
|
expect(page).to have_content("Upload lettings logs in bulk (2023/24)") |
|
|
|
|
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") |
|
|
|
|
attach_file "file", file_fixture("2023_24_lettings_bulk_upload.xlsx") |
|
|
|
|
click_button("Upload") |
|
|
|
|
|
|
|
|
|
allow_any_instance_of(Forms::BulkUploadLettings::UploadYourFile).to receive(:`).and_return("text/csv") |
|
|
|
|
|