|
|
@ -2,11 +2,37 @@ require "rails_helper" |
|
|
|
|
|
|
|
|
|
|
|
RSpec.describe BulkUploadController, type: :request do |
|
|
|
RSpec.describe BulkUploadController, type: :request do |
|
|
|
let(:url) { "/case-logs/bulk-upload" } |
|
|
|
let(:url) { "/case-logs/bulk-upload" } |
|
|
|
let(:organisation) { FactoryBot.create(:organisation) } |
|
|
|
let(:user) { FactoryBot.create(:user) } |
|
|
|
|
|
|
|
let(:organisation) { user.organisation } |
|
|
|
before do |
|
|
|
before do |
|
|
|
allow(Organisation).to receive(:find).with(107_242).and_return(organisation) |
|
|
|
allow(Organisation).to receive(:find).with(107_242).and_return(organisation) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "a not signed in user" do |
|
|
|
|
|
|
|
describe "GET #show" do |
|
|
|
|
|
|
|
it "does not let you see the bulk upload page" do |
|
|
|
|
|
|
|
get url, headers: headers, params: {} |
|
|
|
|
|
|
|
expect(response).to redirect_to("/users/sign-in") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "POST #bulk upload" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
@file = fixture_file_upload("2021_22_lettings_bulk_upload.xlsx", "application/vnd.ms-excel") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not let you submit bulk uploads" do |
|
|
|
|
|
|
|
post url, params: { bulk_upload: { case_log_bulk_upload: @file } } |
|
|
|
|
|
|
|
expect(response).to redirect_to("/users/sign-in") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "a signed in user" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
sign_in user |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "GET #show" do |
|
|
|
describe "GET #show" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
get url, params: {} |
|
|
|
get url, params: {} |
|
|
@ -61,4 +87,5 @@ RSpec.describe BulkUploadController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|