Browse Source

fix test (#1047)

- we now do a lookup for the expected start year on current form
pull/1050/head v0.2.23
Phil Lee 2 years ago committed by GitHub
parent
commit
d52d45b941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      spec/requests/bulk_upload_lettings_logs_controller_spec.rb
  2. 4
      spec/requests/bulk_upload_sales_logs_controller_spec.rb

4
spec/requests/bulk_upload_lettings_logs_controller_spec.rb

@ -10,11 +10,13 @@ RSpec.describe BulkUploadLettingsLogsController, type: :request do
describe "GET /lettings-logs/bulk-upload-logs/start" do describe "GET /lettings-logs/bulk-upload-logs/start" do
context "when not in crossover period" do context "when not in crossover period" do
let(:expected_year) { FormHandler.instance.forms["current_lettings"].start_date.year }
it "redirects to /prepare-your-file" do it "redirects to /prepare-your-file" do
Timecop.freeze(2022, 1, 1) do Timecop.freeze(2022, 1, 1) do
get "/lettings-logs/bulk-upload-logs/start", params: {} get "/lettings-logs/bulk-upload-logs/start", params: {}
expect(response).to redirect_to("/lettings-logs/bulk-upload-logs/prepare-your-file?form%5Byear%5D=2022") expect(response).to redirect_to("/lettings-logs/bulk-upload-logs/prepare-your-file?form%5Byear%5D=#{expected_year}")
end end
end end
end end

4
spec/requests/bulk_upload_sales_logs_controller_spec.rb

@ -10,11 +10,13 @@ RSpec.describe BulkUploadSalesLogsController, type: :request do
describe "GET /sales-logs/bulk-upload-logs/start" do describe "GET /sales-logs/bulk-upload-logs/start" do
context "when not in crossover period" do context "when not in crossover period" do
let(:expected_year) { FormHandler.instance.forms["current_sales"].start_date.year }
it "redirects to /prepare-your-file" do it "redirects to /prepare-your-file" do
Timecop.freeze(2022, 1, 1) do Timecop.freeze(2022, 1, 1) do
get "/sales-logs/bulk-upload-logs/start", params: {} get "/sales-logs/bulk-upload-logs/start", params: {}
expect(response).to redirect_to("/sales-logs/bulk-upload-logs/prepare-your-file?form%5Byear%5D=2022") expect(response).to redirect_to("/sales-logs/bulk-upload-logs/prepare-your-file?form%5Byear%5D=#{expected_year}")
end end
end end
end end

Loading…
Cancel
Save