Browse Source

CLDC-1917 test flakiness fix (#1437)

* feat: add validation with feature flag, typo fix and update tests

* feat: flip feature toggle

* feat: update feature toggle name

* feat: fix form handler inequality

* refactor: linting

* refactor: use between in form handler

* feat: remove feature toggle

* feat: add dynamic date to lettings log factory

* feat: fix log_summary_component_spec.rb tests

* feat: update lettings_log.rb and start fixing lettings_log_spec.rb

* feat: fix more tests

* feat: fix more tests

* feat: fix lettings log import service

* refactor: linting

* feat: fix checkboxes_spec.rb

* feat: fix interruption_screen_helper_spec.rb

* feat: fix check_answers_helper_spec.rb

* feat: fix page_routing_spec.rb

* feat: fix lettings_logs_field_import_service_spec.rb

* feat: fix lettings_log_spec.rb

* feat: fix question_spec.rb

* feat: fix lettings_logs_controller_spec.rb

* feat: fix check_answers_page_lettings_logs_spec.rb

* feat: fix tenancy_validations_spec.rb

* feat: fix validations_spec.rb

* feat: fix accessible_autocomplete_spec.rb

* feat: fix form_navigation_spec.rb

* feat: fix soft_validations_spec.rb

* feat: fix lettings_log_export_service_spec.rb

* feat: fix saving_data_spec.rb

* feat: fix page_spec.rb

* feat: fix form_controller_spec.rb

* refactor: linting

* feat: fix subsection_spec.rb

* feat: fix lettings_log_spec.rb

* feat: fix financial_validations_spec.rb

* feat: fix tasklist_page_spec.rb

* feat: fix conditional_questions_spec.rb

* feat: fix form_page_error_helper_spec.rb and log_summary_component_spec.rb

* feat: fix lettings_log_csv_service_spec.rb

* feat: fix tasklist_helper_spec.rb

* refactor: linting

* refactor: linting

* feat: fix lettings_log_spec.rb

* refactor: linting

* refactor: replace financial year with collection yaer

* feat: respond to PR comments pt. 1

* feat: respond to PR comments pt. 2

* feat: unfreeze all timecop freezes
pull/1438/head
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
5606d06491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      spec/helpers/collection_time_helper_spec.rb
  2. 1
      spec/models/form_handler_spec.rb
  3. 2
      spec/models/validations/sales/financial_validations_spec.rb
  4. 4
      spec/models/validations/tenancy_validations_spec.rb
  5. 2
      spec/requests/lettings_logs_controller_spec.rb
  6. 2
      spec/requests/sales_logs_controller_spec.rb
  7. 1
      spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb
  8. 1
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

1
spec/helpers/collection_time_helper_spec.rb

@ -9,6 +9,7 @@ RSpec.describe CollectionTimeHelper do
Timecop.freeze(now) do Timecop.freeze(now) do
example.run example.run
end end
Timecop.return
end end
context "when the date is after 1st of April" do context "when the date is after 1st of April" do

1
spec/models/form_handler_spec.rb

@ -9,6 +9,7 @@ RSpec.describe FormHandler do
Singleton.__init__(described_class) Singleton.__init__(described_class)
example.run example.run
end end
Timecop.return
Singleton.__init__(described_class) Singleton.__init__(described_class)
end end

2
spec/models/validations/sales/financial_validations_spec.rb

@ -274,7 +274,7 @@ RSpec.describe Validations::Sales::FinancialValidations do
Timecop.freeze(now) do Timecop.freeze(now) do
example.run example.run
end end
Timecop.unfreeze Timecop.return
end end
context "with a log in the 22/23 collection year" do context "with a log in the 22/23 collection year" do

4
spec/models/validations/tenancy_validations_spec.rb

@ -7,6 +7,10 @@ RSpec.describe Validations::TenancyValidations do
Timecop.freeze(Time.zone.local(2021, 5, 1)) Timecop.freeze(Time.zone.local(2021, 5, 1))
end end
after do
Timecop.unfreeze
end
let(:validator_class) { Class.new { include Validations::TenancyValidations } } let(:validator_class) { Class.new { include Validations::TenancyValidations } }
let(:record) { FactoryBot.create(:lettings_log, startdate: Time.zone.local(2021, 5, 1), needstype: 1, rent_type: 1) } let(:record) { FactoryBot.create(:lettings_log, startdate: Time.zone.local(2021, 5, 1), needstype: 1, rent_type: 1) }

2
spec/requests/lettings_logs_controller_spec.rb

@ -337,7 +337,7 @@ RSpec.describe LettingsLogsController, type: :request do
Timecop.freeze(2022, 3, 1) do Timecop.freeze(2022, 3, 1) do
example.run example.run
end end
Timecop.unfreeze Timecop.return
end end
let!(:lettings_log_2021) do let!(:lettings_log_2021) do

2
spec/requests/sales_logs_controller_spec.rb

@ -235,7 +235,7 @@ RSpec.describe SalesLogsController, type: :request do
Timecop.freeze(2022, 12, 1) do Timecop.freeze(2022, 12, 1) do
example.run example.run
end end
Timecop.unfreeze Timecop.return
end end
let!(:sales_log_2022) do let!(:sales_log_2022) do

1
spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

@ -610,6 +610,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
Timecop.freeze(Date.new(2022, 4, 2)) do Timecop.freeze(Date.new(2022, 4, 2)) do
example.run example.run
end end
Timecop.return
end end
let(:attributes) { { bulk_upload:, field_96: "1", field_97: "1", field_98: "22" } } let(:attributes) { { bulk_upload:, field_96: "1", field_97: "1", field_98: "22" } }

1
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -562,6 +562,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
Timecop.freeze(Date.new(2022, 4, 2)) do Timecop.freeze(Date.new(2022, 4, 2)) do
example.run example.run
end end
Timecop.return
end end
let(:attributes) { { bulk_upload:, field_7: "1", field_8: "1", field_9: "22" } } let(:attributes) { { bulk_upload:, field_7: "1", field_8: "1", field_9: "22" } }

Loading…
Cancel
Save