You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
52 lines
1.4 KiB
2 years ago
|
require "rails_helper"
|
||
|
|
||
|
RSpec.describe "Bulk upload sales log" do
|
||
|
let(:user) { create(:user) }
|
||
|
|
||
|
before do
|
||
|
sign_in user
|
||
|
end
|
||
|
|
||
|
context "when during crossover period" do
|
||
|
it "shows journey with year option" do
|
||
|
Timecop.freeze(2023, 6, 1) do
|
||
|
visit("/sales-logs")
|
||
|
expect(page).to have_link("Upload sales logs in bulk")
|
||
|
click_link("Upload sales logs in bulk")
|
||
|
|
||
|
expect(page).to have_content("Which year")
|
||
|
click_button("Continue")
|
||
|
|
||
|
expect(page).to have_content("You must select a collection period to upload for")
|
||
|
choose("2022/2023")
|
||
|
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 sales logs in bulk (2022/23)")
|
||
|
click_button("Continue")
|
||
|
|
||
|
expect(page).to have_content("Upload your file")
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context "when not it crossover period" do
|
||
|
it "shows journey with year option" do
|
||
|
Timecop.freeze(2023, 10, 1) do
|
||
|
visit("/sales-logs")
|
||
|
expect(page).to have_link("Upload sales logs in bulk")
|
||
|
click_link("Upload sales logs in bulk")
|
||
|
|
||
|
expect(page).to have_content("Upload sales logs in bulk (2022/23)")
|
||
|
click_button("Continue")
|
||
|
|
||
|
expect(page).to have_content("Upload your file")
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|