Browse Source

Update/remove tests

pull/2895/head
Kat 8 months ago
parent
commit
be9e5f7585
  1. 14
      spec/features/bulk_upload_sales_logs_spec.rb
  2. 8
      spec/models/sales_log_spec.rb
  3. 14
      spec/models/validations/financial_validations_spec.rb
  4. 1
      spec/requests/bulk_upload_lettings_logs_controller_spec.rb
  5. 1
      spec/requests/bulk_upload_sales_logs_controller_spec.rb

14
spec/features/bulk_upload_sales_logs_spec.rb

@ -22,7 +22,7 @@ RSpec.describe "Bulk upload sales log" do
# rubocop:disable RSpec/AnyInstance # rubocop:disable RSpec/AnyInstance
context "when during crossover period" do context "when during crossover period" do
before do before do
Timecop.freeze(2023, 5, 1) Timecop.freeze(2024, 5, 1)
end end
after do after do
@ -38,15 +38,15 @@ RSpec.describe "Bulk upload sales log" do
click_button("Continue") click_button("Continue")
expect(page).to have_content("You must select a collection period to upload for") expect(page).to have_content("You must select a collection period to upload for")
choose("2023 to 2024") choose("2024 to 2025")
click_button("Continue") click_button("Continue")
click_link("Back") click_link("Back")
expect(page.find_field("form-year-2023-field")).to be_checked expect(page.find_field("form-year-2024-field")).to be_checked
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload sales logs in bulk (2023 to 2024)") expect(page).to have_content("Upload sales logs in bulk (2024 to 2025)")
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload your file") expect(page).to have_content("Upload your file")
@ -80,7 +80,7 @@ RSpec.describe "Bulk upload sales log" do
expect(page).to have_content("Which year") expect(page).to have_content("Which year")
click_button("Continue") click_button("Continue")
click_button("Continue") click_button("Continue")
choose("2023 to 2024") choose("2024 to 2025")
click_button("Continue") click_button("Continue")
click_button("Continue") click_button("Continue")
@ -96,7 +96,7 @@ RSpec.describe "Bulk upload sales log" do
context "when not in crossover period" do context "when not in crossover period" do
before do before do
Timecop.freeze(2024, 2, 1) Timecop.freeze(2025, 2, 1)
end end
after do after do
@ -108,7 +108,7 @@ RSpec.describe "Bulk upload sales log" do
expect(page).to have_link("Upload sales logs in bulk") expect(page).to have_link("Upload sales logs in bulk")
click_link("Upload sales logs in bulk") click_link("Upload sales logs in bulk")
expect(page).to have_content("Upload sales logs in bulk (2023 to 2024)") expect(page).to have_content("Upload sales logs in bulk (2024 to 2025)")
click_button("Continue") click_button("Continue")
expect(page).to have_content("Upload your file") expect(page).to have_content("Upload your file")

8
spec/models/sales_log_spec.rb

@ -120,14 +120,6 @@ RSpec.describe SalesLog, type: :model do
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 5, 1)) allow(Time).to receive(:now).and_return(Time.zone.local(2023, 5, 1))
end end
it "is set to completed for a log with a saledate before 23/24" do
completed_sales_log.update!(proplen: nil, proplen_asked: 0, saledate: Time.zone.local(2022, 5, 1))
expect(completed_sales_log.in_progress?).to be(false)
expect(completed_sales_log.not_started?).to be(false)
expect(completed_sales_log.completed?).to be(true)
expect(completed_sales_log.deleted?).to be(false)
end
it "is set to in_progress for a log with a saledate after 23/24" do it "is set to in_progress for a log with a saledate after 23/24" do
completed_sales_log.update!(proplen: nil, proplen_asked: 0, saledate: Time.zone.local(2023, 5, 1)) completed_sales_log.update!(proplen: nil, proplen_asked: 0, saledate: Time.zone.local(2023, 5, 1))
expect(completed_sales_log.in_progress?).to be(true) expect(completed_sales_log.in_progress?).to be(true)

14
spec/models/validations/financial_validations_spec.rb

@ -338,20 +338,6 @@ RSpec.describe Validations::FinancialValidations do
expect(record.errors["ecstat#{n}"]).to be_empty expect(record.errors["ecstat#{n}"]).to be_empty
end end
end end
context "when the net income is lower than the hard min for their employment status for 22/23 collection" do
it "does not add an error" do
record.startdate = Time.zone.local(2022, 5, 1)
record.earnings = 50
record.incfreq = 1
record.hhmemb = 1
record.ecstat1 = 1
financial_validator.validate_net_income(record)
expect(record.errors["earnings"]).to be_empty
expect(record.errors["ecstat1"]).to be_empty
expect(record.errors["hhmemb"]).to be_empty
end
end
end end
end end

1
spec/requests/bulk_upload_lettings_logs_controller_spec.rb

@ -112,6 +112,7 @@ RSpec.describe BulkUploadLettingsLogsController, type: :request do
context "when requesting the previous year in a crossover period" do context "when requesting the previous year in a crossover period" do
before do before do
allow(Time.zone).to receive(:now).and_return(Time.zone.now + 1.year)
allow(FormHandler.instance).to receive(:lettings_in_crossover_period?).and_return(true) allow(FormHandler.instance).to receive(:lettings_in_crossover_period?).and_return(true)
end end

1
spec/requests/bulk_upload_sales_logs_controller_spec.rb

@ -112,6 +112,7 @@ RSpec.describe BulkUploadSalesLogsController, type: :request do
context "when requesting the previous year in a crossover period" do context "when requesting the previous year in a crossover period" do
before do before do
allow(Time.zone).to receive(:now).and_return(Time.zone.now + 1.year)
allow(FormHandler.instance).to receive(:sales_in_crossover_period?).and_return(true) allow(FormHandler.instance).to receive(:sales_in_crossover_period?).and_return(true)
end end

Loading…
Cancel
Save