|
|
|
@ -908,15 +908,21 @@ RSpec.describe LettingsLogsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with a signed in user" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(2021, 4, 1) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
completed_lettings_log.update!(startdate: Time.zone.local(2021, 4, 1), voiddate: Time.zone.local(2021, 4, 1), mrcdate: Time.zone.local(2021, 4, 1)) |
|
|
|
|
completed_lettings_log.reload |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with lettings logs that are owned or managed by your organisation" do |
|
|
|
|
before do |
|
|
|
|
sign_in user |
|
|
|
|
get "/lettings-logs/#{lettings_log.id}", headers:, params: {} |
|
|
|
|
Timecop.freeze(2021, 4, 1) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
completed_lettings_log.update!(startdate: Time.zone.local(2021, 4, 1), voiddate: Time.zone.local(2021, 4, 1), mrcdate: Time.zone.local(2021, 4, 1)) |
|
|
|
|
completed_lettings_log.reload |
|
|
|
|
Timecop.unfreeze |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -933,7 +939,7 @@ RSpec.describe LettingsLogsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "displays a link to update the log for currently editable logs" do |
|
|
|
|
completed_lettings_log.update!(startdate: Time.zone.local(2022, 4, 1), tenancylength: nil) |
|
|
|
|
completed_lettings_log.update!(startdate: Time.zone.local(2021, 4, 1), tenancylength: nil) |
|
|
|
|
completed_lettings_log.reload |
|
|
|
|
|
|
|
|
|
get "/lettings-logs/#{completed_lettings_log.id}", headers:, params: {} |
|
|
|
@ -941,11 +947,43 @@ RSpec.describe LettingsLogsController, type: :request do
|
|
|
|
|
expect(completed_lettings_log.status).to eq("completed") |
|
|
|
|
expect(page).to have_link("review and make changes to this log", href: "/lettings-logs/#{completed_lettings_log.id}/review") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
xit "displays a closed collection window message for previous collection year logs" do |
|
|
|
|
context "with lettings logs from a closed collection period before the previous collection" do |
|
|
|
|
before do |
|
|
|
|
sign_in user |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
get "/lettings-logs/#{completed_lettings_log.id}", headers:, params: {} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects to review page" do |
|
|
|
|
expect(response).to redirect_to("/lettings-logs/#{completed_lettings_log.id}/review") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with lettings logs from a closed previous collection period" do |
|
|
|
|
before do |
|
|
|
|
sign_in user |
|
|
|
|
Timecop.freeze(2023, 2, 1) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
get "/lettings-logs/#{completed_lettings_log.id}", headers:, params: {} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects to review page" do |
|
|
|
|
expect(response).to redirect_to("/lettings-logs/#{completed_lettings_log.id}/review") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "displays a closed collection window message for previous collection year logs" do |
|
|
|
|
get "/lettings-logs/#{completed_lettings_log.id}", headers:, params: {} |
|
|
|
|
expect(completed_lettings_log.form.new_logs_end_date).to eq(Time.zone.local(2022, 7, 1)) |
|
|
|
|
expect(completed_lettings_log.status).to eq("completed") |
|
|
|
|
follow_redirect! |
|
|
|
|
expect(page).to have_content("This log is from the 2021/2022 collection window, which is now closed.") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -992,10 +1030,17 @@ RSpec.describe LettingsLogsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(2021, 4, 1) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
sign_in user |
|
|
|
|
get "/lettings-logs/#{section_completed_lettings_log.id}", headers:, params: {} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.unfreeze |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "displays a section status for a lettings log" do |
|
|
|
|
assert_select ".govuk-tag", text: /Not started/, count: 6 |
|
|
|
|
assert_select ".govuk-tag", text: /Completed/, count: 1 |
|
|
|
@ -1019,12 +1064,19 @@ RSpec.describe LettingsLogsController, type: :request do
|
|
|
|
|
let!(:location) { FactoryBot.create(:location, scheme:) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(2021, 4, 1) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
FactoryBot.create_list(:lettings_log, 3, unresolved: true, created_by: user) |
|
|
|
|
lettings_log.update!(needstype: 2, scheme:, location:, unresolved: true) |
|
|
|
|
sign_in user |
|
|
|
|
get "/lettings-logs/#{lettings_log.id}", headers:, params: {} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "marks it as resolved when both scheme and location exist" do |
|
|
|
|
lettings_log.reload |
|
|
|
|
expect(lettings_log.unresolved).to eq(false) |
|
|
|
|