|
|
|
@ -13,6 +13,14 @@ RSpec.describe BulkUploadController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when a user is not signed in" do |
|
|
|
context "when a user is not signed in" do |
|
|
|
|
|
|
|
describe "GET #start" do |
|
|
|
|
|
|
|
before { get start_bulk_upload_lettings_logs_path, headers:, params: {} } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not let you see the bulk upload page" do |
|
|
|
|
|
|
|
expect(response).to redirect_to("/account/sign-in") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "GET #show" do |
|
|
|
describe "GET #show" do |
|
|
|
before { get url, headers:, params: {} } |
|
|
|
before { get url, headers:, params: {} } |
|
|
|
|
|
|
|
|
|
|
|
@ -50,6 +58,40 @@ RSpec.describe BulkUploadController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "GET #start" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
Timecop.freeze(time) |
|
|
|
|
|
|
|
get start_bulk_upload_lettings_logs_path |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
|
|
|
Timecop.unfreeze |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when not crossover period" do |
|
|
|
|
|
|
|
let(:time) { Time.utc(2022, 2, 8) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "redirects to bulk upload path" do |
|
|
|
|
|
|
|
expect(request).to redirect_to( |
|
|
|
|
|
|
|
bulk_upload_lettings_log_path( |
|
|
|
|
|
|
|
id: "prepare-your-file", |
|
|
|
|
|
|
|
form: { year: 2021 }, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when crossover period" do |
|
|
|
|
|
|
|
let(:time) { Time.utc(2022, 6, 8) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "redirects to bulk upload path" do |
|
|
|
|
|
|
|
expect(request).to redirect_to( |
|
|
|
|
|
|
|
bulk_upload_lettings_log_path(id: "year"), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "POST #bulk upload" do |
|
|
|
describe "POST #bulk upload" do |
|
|
|
context "with a valid file based on the upload template" do |
|
|
|
context "with a valid file based on the upload template" do |
|
|
|
let(:request) { post url, params: { bulk_upload: { lettings_log_bulk_upload: valid_file } } } |
|
|
|
let(:request) { post url, params: { bulk_upload: { lettings_log_bulk_upload: valid_file } } } |
|
|
|
|