Browse Source

Merge branch 'main' into CLDC-2571-create-absorbed-relationship

# Conflicts:
#	db/schema.rb
pull/1789/head
natdeanlewissoftwire 3 years ago
parent
commit
0490ca5c71
  1. 4
      app/helpers/filters_helper.rb
  2. 18
      app/helpers/logs_helper.rb
  3. 4
      app/models/bulk_upload.rb
  4. 4
      app/models/forms/bulk_upload_lettings_resume/fix_choice.rb
  5. 4
      app/models/forms/bulk_upload_sales_resume/fix_choice.rb
  6. 6
      app/models/validations/household_validations.rb
  7. 4
      app/services/bulk_upload/lettings/validator.rb
  8. 1
      app/services/bulk_upload/processor.rb
  9. 4
      app/services/bulk_upload/sales/validator.rb
  10. 2
      app/services/imports/lettings_logs_import_service.rb
  11. 6
      app/views/bulk_upload_lettings_resume/confirm.html.erb
  12. 25
      app/views/bulk_upload_lettings_resume/fix_choice.html.erb
  13. 4
      app/views/bulk_upload_lettings_soft_validations_check/confirm.html.erb
  14. 4
      app/views/bulk_upload_sales_resume/confirm.html.erb
  15. 25
      app/views/bulk_upload_sales_resume/fix_choice.html.erb
  16. 4
      app/views/bulk_upload_sales_soft_validations_check/confirm.html.erb
  17. 4
      app/views/logs/index.html.erb
  18. 4
      config/locales/en.yml
  19. 5
      db/migrate/20230713140231_add_total_logs_count_to_bulk_upload.rb
  20. 32
      db/schema.rb
  21. 14
      spec/features/lettings_log_spec.rb
  22. 5
      spec/helpers/filters_helper_spec.rb
  23. 8
      spec/models/validations/household_validations_spec.rb
  24. 4
      spec/requests/bulk_upload_lettings_resume_controller_spec.rb
  25. 6
      spec/requests/bulk_upload_lettings_soft_validations_check_controller_spec.rb
  26. 4
      spec/requests/bulk_upload_sales_resume_controller_spec.rb
  27. 6
      spec/requests/bulk_upload_sales_soft_validations_check_controller_spec.rb
  28. 10
      spec/requests/lettings_logs_controller_spec.rb
  29. 10
      spec/requests/sales_logs_controller_spec.rb
  30. 4
      spec/services/bulk_upload/lettings/validator_spec.rb
  31. 10
      spec/services/bulk_upload/processor_spec.rb
  32. 27
      spec/services/bulk_upload/sales/validator_spec.rb
  33. 8
      spec/services/imports/lettings_logs_import_service_spec.rb

4
app/helpers/filters_helper.rb

@ -91,8 +91,8 @@ private
filters.each.sum do |category, category_filters| filters.each.sum do |category, category_filters|
if %w[status years bulk_upload_id].include?(category) if %w[status years bulk_upload_id].include?(category)
category_filters.count(&:present?) category_filters.count(&:present?)
elsif %w[assigned_to organisation].include?(category) elsif %w[user owning_organisation managing_organisation].include?(category)
category_filters != "all" ? 1 : 0 1
else else
0 0
end end

18
app/helpers/logs_helper.rb

@ -41,9 +41,19 @@ module LogsHelper
end end
end end
def pluralize_logs_and_errors_warning(log_count, error_count) def logs_and_errors_warning(bulk_upload)
is_or_are = log_count == 1 ? "is" : "are" this_or_these_errors = bulk_upload.bulk_upload_errors.count == 1 ? "This error" : "These errors"
need_or_needs = error_count == 1 ? "needs" : "need"
"There #{is_or_are} #{pluralize(log_count, 'log')} in this bulk upload with #{pluralize(error_count, 'error')} that still #{need_or_needs} to be fixed after upload." "You will upload #{pluralize(bulk_upload.total_logs_count, 'log')}. There are errors in #{pluralize(bulk_upload.logs_with_errors_count, 'log')}, and #{pluralize(bulk_upload.bulk_upload_errors.count, 'error')} in total. #{this_or_these_errors} will need to be fixed on the CORE site."
end
def logs_and_soft_validations_warning(bulk_upload)
this_or_these_unexpected_answers = bulk_upload.bulk_upload_errors.count == 1 ? "This unexpected answer" : "These unexpected answers"
"You will upload #{pluralize(bulk_upload.total_logs_count, 'log')}. There are unexpected answers in #{pluralize(bulk_upload.logs_with_errors_count, 'log')}, and #{pluralize(bulk_upload.bulk_upload_errors.count, 'unexpected answer')} in total. #{this_or_these_unexpected_answers} will be marked as correct."
end
def bulk_upload_error_summary(bulk_upload)
"You have tried to upload #{bulk_upload.total_logs_count ? pluralize(bulk_upload.total_logs_count, 'log') : 'logs'}. There are errors in #{pluralize(bulk_upload.logs_with_errors_count, 'log')}, and #{pluralize(bulk_upload.bulk_upload_errors.count, 'error')} in total."
end end
end end

4
app/models/bulk_upload.rb

@ -107,6 +107,10 @@ class BulkUpload < ApplicationRecord
end end
end end
def logs_with_errors_count
bulk_upload_errors.distinct.count("row")
end
private private
def generate_identifier def generate_identifier

4
app/models/forms/bulk_upload_lettings_resume/fix_choice.rb

@ -39,9 +39,9 @@ module Forms
def recommendation def recommendation
if BulkUploadErrorSummaryTableComponent.new(bulk_upload:).errors? if BulkUploadErrorSummaryTableComponent.new(bulk_upload:).errors?
"For this many errors we recommend to fix errors in the CSV and re-upload as you may be able to edit many fields at once in a CSV." "We recommend fixing these errors in the CSV, as you may be able to edit multiple fields at once. However, you can also upload these logs and fix the errors on the CORE site."
else else
"For this many errors we recommend to upload logs and fix errors on site as you can easily see the questions and select the appropriate answer." "We recommend uploading logs and fixing errors on site as you can easily see the questions and select the appropriate answer. However, you can also fix these errors in the CSV."
end end
end end

4
app/models/forms/bulk_upload_sales_resume/fix_choice.rb

@ -39,9 +39,9 @@ module Forms
def recommendation def recommendation
if BulkUploadErrorSummaryTableComponent.new(bulk_upload:).errors? if BulkUploadErrorSummaryTableComponent.new(bulk_upload:).errors?
"For this many errors we recommend to fix errors in the CSV and re-upload as you may be able to edit many fields at once in a CSV." "We recommend fixing these errors in the CSV, as you may be able to edit multiple fields at once. However, you can also upload these logs and fix the errors on the CORE site."
else else
"For this many errors we recommend to upload logs and fix errors on site as you can easily see the questions and select the appropriate answer." "We recommend uploading logs and fixing errors on site as you can easily see the questions and select the appropriate answer. However, you can also fix these errors in the CSV."
end end
end end

6
app/models/validations/household_validations.rb

@ -60,9 +60,9 @@ module Validations::HouseholdValidations
record.errors.add :prevten, :non_temp_accommodation, message: I18n.t("validations.household.prevten.non_temp_accommodation") record.errors.add :prevten, :non_temp_accommodation, message: I18n.t("validations.household.prevten.non_temp_accommodation")
end end
if record.age1.present? && record.age1 > 19 && record.previous_tenancy_was_foster_care? if record.age1.present? && record.age1 > 25 && record.previous_tenancy_was_foster_care?
record.errors.add :prevten, :over_20_foster_care, message: I18n.t("validations.household.prevten.over_20_foster_care") record.errors.add :prevten, :over_25_foster_care, message: I18n.t("validations.household.prevten.over_25_foster_care")
record.errors.add :age1, I18n.t("validations.household.age.lead.over_20") record.errors.add :age1, I18n.t("validations.household.age.lead.over_25")
end end
if record.sex1 == "M" && record.previous_tenancy_was_refuge? if record.sex1 == "M" && record.previous_tenancy_was_refuge?

4
app/services/bulk_upload/lettings/validator.rb

@ -73,6 +73,10 @@ class BulkUpload::Lettings::Validator
row_parsers.any?(&:log_already_exists?) row_parsers.any?(&:log_already_exists?)
end end
def total_logs_count
csv_parser.body_rows.count
end
private private
# n^2 algo # n^2 algo

1
app/services/bulk_upload/processor.rb

@ -10,6 +10,7 @@ class BulkUpload::Processor
download download
@bulk_upload.update!(total_logs_count: validator.total_logs_count)
return send_failure_mail(errors: validator.errors.full_messages) if validator.invalid? return send_failure_mail(errors: validator.errors.full_messages) if validator.invalid?
validator.call validator.call

4
app/services/bulk_upload/sales/validator.rb

@ -67,6 +67,10 @@ class BulkUpload::Sales::Validator
errors.count == errors.where(category: "soft_validation").count && errors.count.positive? errors.count == errors.where(category: "soft_validation").count && errors.count.positive?
end end
def total_logs_count
csv_parser.body_rows.count
end
private private
# n^2 algo # n^2 algo

2
app/services/imports/lettings_logs_import_service.rb

@ -308,7 +308,7 @@ module Imports
%i[referral internal_transfer_non_social_housing] => %w[referral], %i[referral internal_transfer_non_social_housing] => %w[referral],
%i[referral internal_transfer_fixed_or_lifetime] => %w[referral], %i[referral internal_transfer_fixed_or_lifetime] => %w[referral],
%i[tenancylength tenancylength_invalid] => %w[tenancylength tenancy], %i[tenancylength tenancylength_invalid] => %w[tenancylength tenancy],
%i[prevten over_20_foster_care] => %w[prevten age1], %i[prevten over_25_foster_care] => %w[prevten age1],
%i[prevten non_temp_accommodation] => %w[prevten rsnvac], %i[prevten non_temp_accommodation] => %w[prevten rsnvac],
%i[joint not_joint_tenancy] => %w[joint], %i[joint not_joint_tenancy] => %w[joint],
%i[offered outside_the_range] => %w[offered], %i[offered outside_the_range] => %w[offered],

6
app/views/bulk_upload_lettings_resume/confirm.html.erb

@ -5,12 +5,12 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1> <h1 class="govuk-heading-l">You have chosen to upload all logs from this bulk upload.</h1>
<p class="govuk-body"><%= pluralize_logs_and_errors_warning(@bulk_upload.logs.count, @bulk_upload.bulk_upload_errors.count) %> </p> <p class="govuk-body"><%= logs_and_errors_warning(@bulk_upload) %></p>
<%= form_with model: @form, scope: :form, url: page_bulk_upload_lettings_resume_path(@bulk_upload, page: "confirm"), method: :patch do |f| %> <%= form_with model: @form, scope: :form, url: page_bulk_upload_lettings_resume_path(@bulk_upload, page: "confirm"), method: :patch do |f| %>
<%= f.govuk_submit %> <%= f.govuk_submit "Confirm" %>
<%= govuk_button_link_to "Cancel", @form.back_path, secondary: true %> <%= govuk_button_link_to "Cancel", @form.back_path, secondary: true %>
<% end %> <% end %>

25
app/views/bulk_upload_lettings_resume/fix_choice.html.erb

@ -4,24 +4,33 @@
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">How would you like to fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %>?</h1> <h1 class="govuk-heading-l">How would you like to fix the errors?</h1>
<div class="govuk-body-l"> <div class="govuk-body-l">
File: <%= @bulk_upload.filename %> File: <%= @bulk_upload.filename %>
</div> </div>
<div class="govuk-body">
<%= bulk_upload_error_summary(@bulk_upload) %>
</div>
<div class="govuk-body"> <div class="govuk-body">
<%= @form.recommendation %> <%= @form.recommendation %>
</div> </div>
<%= govuk_details(summary_text: "How to choose between fixing errors on the CORE site or in the CSV") do %> <%= govuk_details(summary_text: "How to choose between fixing errors on the CORE site or in the CSV") do %>
<p class="govuk-body">When it comes to fixing errors, there are pros and cons to doing it on a CSV versus doing it on a website.</p> <p class="govuk-body govuk-!-margin-bottom-2">You may find it easier to fix the errors in the CSV file if:</p>
<ul class="govuk-list govuk-list--bullet">
<p class="govuk-body">Fixing errors on a CSV file can be beneficial because it allows you to easily make changes to multiple records at once, and you can use tools like Excel to quickly identify and correct errors. However, if the CSV file is not properly formatted, it can be difficult to identify which records contain errors.</p> <li>you have a lot of errors</li>
<li>the CSV file is formatted incorrectly and you can see where the errors are</li>
<p class="govuk-body">Fixing errors on a website can be convenient because you can see the data in context and make changes in real-time. However, this approach can be time-consuming if you need to make changes to multiple records, and it may be more difficult to identify errors in a large dataset.</p> <li>you need to fix multiple errors at once</li>
</ul>
<p class="govuk-body">Ultimately, the best approach will depend on the specific situation and the nature of the errors that need to be fixed.</p> <p class="govuk-body govuk-!-margin-bottom-2">You may find it easier to fix the errors on the CORE site if:</p>
<ul class="govuk-list govuk-list--bullet">
<li>you need to see the data in context</li>
<li>you have a smaller file, with a few errors</li>
<li>you are not sure where the errors are</li>
</ul>
<% end %> <% end %>
<%= f.govuk_collection_radio_buttons :choice, <%= f.govuk_collection_radio_buttons :choice,

4
app/views/bulk_upload_lettings_soft_validations_check/confirm.html.erb

@ -5,9 +5,9 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1> <h1 class="govuk-heading-l">You have chosen to upload all logs from this bulk upload.</h1>
<p class="govuk-body">There are <%= pluralize(@bulk_upload.logs.count, "log") %> in this bulk upload, and <%= pluralize(@bulk_upload.bulk_upload_errors.count, "unexpected answer") %> will be marked as correct.</p> <p class="govuk-body"><%= logs_and_soft_validations_warning(@bulk_upload) %></p>
<%= form_with model: @form, scope: :form, url: page_bulk_upload_lettings_soft_validations_check_path(@bulk_upload, page: "confirm"), method: :patch do |f| %> <%= form_with model: @form, scope: :form, url: page_bulk_upload_lettings_soft_validations_check_path(@bulk_upload, page: "confirm"), method: :patch do |f| %>
<%= f.govuk_submit %> <%= f.govuk_submit %>

4
app/views/bulk_upload_sales_resume/confirm.html.erb

@ -5,9 +5,9 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1> <h1 class="govuk-heading-l">You have chosen to upload all logs from this bulk upload.</h1>
<p class="govuk-body">There are <%= pluralize(@bulk_upload.logs.count, "log") %> in this bulk upload with <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> that still need to be fixed after upload.</p> <p class="govuk-body"><%= logs_and_errors_warning(@bulk_upload) %></p>
<%= form_with model: @form, scope: :form, url: page_bulk_upload_sales_resume_path(@bulk_upload, page: "confirm"), method: :patch do |f| %> <%= form_with model: @form, scope: :form, url: page_bulk_upload_sales_resume_path(@bulk_upload, page: "confirm"), method: :patch do |f| %>
<%= f.govuk_submit %> <%= f.govuk_submit %>

25
app/views/bulk_upload_sales_resume/fix_choice.html.erb

@ -4,24 +4,33 @@
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">How would you like to fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %>?</h1> <h1 class="govuk-heading-l">How would you like to fix the errors?</h1>
<div class="govuk-body-l"> <div class="govuk-body-l">
File: <%= @bulk_upload.filename %> File: <%= @bulk_upload.filename %>
</div> </div>
<div class="govuk-body">
<%= bulk_upload_error_summary(@bulk_upload) %>
</div>
<div class="govuk-body"> <div class="govuk-body">
<%= @form.recommendation %> <%= @form.recommendation %>
</div> </div>
<%= govuk_details(summary_text: "How to choose between fixing errors on the CORE site or in the CSV") do %> <%= govuk_details(summary_text: "How to choose between fixing errors on the CORE site or in the CSV") do %>
<p class="govuk-body">When it comes to fixing errors, there are pros and cons to doing it on a CSV versus doing it on a website.</p> <p class="govuk-body govuk-!-margin-bottom-2">You may find it easier to fix the errors in the CSV file if:</p>
<ul class="govuk-list govuk-list--bullet">
<p class="govuk-body">Fixing errors on a CSV file can be beneficial because it allows you to easily make changes to multiple records at once, and you can use tools like Excel to quickly identify and correct errors. However, if the CSV file is not properly formatted, it can be difficult to identify which records contain errors.</p> <li>you have a lot of errors</li>
<li>the CSV file is formatted incorrectly and you can see where the errors are</li>
<p class="govuk-body">Fixing errors on a website can be convenient because you can see the data in context and make changes in real-time. However, this approach can be time-consuming if you need to make changes to multiple records, and it may be more difficult to identify errors in a large dataset.</p> <li>you need to fix multiple errors at once</li>
</ul>
<p class="govuk-body">Ultimately, the best approach will depend on the specific situation and the nature of the errors that need to be fixed.</p> <p class="govuk-body govuk-!-margin-bottom-2">You may find it easier to fix the errors on the CORE site if:</p>
<ul class="govuk-list govuk-list--bullet">
<li>you need to see the data in context</li>
<li>you have a smaller file, with a few errors</li>
<li>you are not sure where the errors are</li>
</ul>
<% end %> <% end %>
<%= f.govuk_collection_radio_buttons :choice, <%= f.govuk_collection_radio_buttons :choice,

4
app/views/bulk_upload_sales_soft_validations_check/confirm.html.erb

@ -5,9 +5,9 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l">Are you sure you want to upload all logs from this bulk upload?</h1> <h1 class="govuk-heading-l">You have chosen to upload all logs from this bulk upload.</h1>
<p class="govuk-body">There are <%= pluralize(@bulk_upload.logs.count, "log") %> in this bulk upload, and <%= pluralize(@bulk_upload.bulk_upload_errors.count, "unexpected answer") %> will be marked as correct.</p> <p class="govuk-body"><%= logs_and_soft_validations_warning(@bulk_upload) %></p>
<%= form_with model: @form, scope: :form, url: page_bulk_upload_sales_soft_validations_check_path(@bulk_upload, page: "confirm"), method: :patch do |f| %> <%= form_with model: @form, scope: :form, url: page_bulk_upload_sales_soft_validations_check_path(@bulk_upload, page: "confirm"), method: :patch do |f| %>
<%= f.govuk_submit %> <%= f.govuk_submit %>

4
app/views/logs/index.html.erb

@ -28,7 +28,7 @@
<% else %> <% else %>
<%= render partial: "organisations/headings", <%= render partial: "organisations/headings",
locals: { locals: {
main: "You need to fix #{pluralize(@pagy.count, 'log')} from your bulk upload", main: "Fix the errors from this bulk upload",
sub: "#{log_type_for_controller(controller).capitalize} logs (#{@bulk_upload.year_combo})", sub: "#{log_type_for_controller(controller).capitalize} logs (#{@bulk_upload.year_combo})",
} %> } %>
@ -36,7 +36,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<p class="govuk-body-l"> <p class="govuk-body-l">
The following logs are from your recent bulk upload. They have some incorrect or incomplete data. You’ll need to answer a few more questions for each one to mark them as complete. You have uploaded <%= pluralize(@bulk_upload.logs.count, "log") %>. There are errors in <%= pluralize(@bulk_upload.logs_with_errors_count, "log") %>, and <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> in total. Select the log to fix the errors.
</p> </p>
<p class="govuk-body"> <p class="govuk-body">

4
config/locales/en.yml

@ -441,7 +441,7 @@ en:
must_be_16_19: "Person must be aged 16-19 if they are a student and have relationship ‘child’" must_be_16_19: "Person must be aged 16-19 if they are a student and have relationship ‘child’"
partner_under_16: "Cannot be under 16 if the relationship is partner" partner_under_16: "Cannot be under 16 if the relationship is partner"
lead: lead:
over_20: "The lead tenant must be under 20 as you told us their housing situation immediately before this letting was a children’s home or foster care" over_25: "The lead tenant must be under 26 as you told us their housing situation immediately before this letting was a children’s home or foster care"
ecstat: ecstat:
retired_over_70: "Person %{person_num} must be retired if over 70" retired_over_70: "Person %{person_num} must be retired if over 70"
child_under_16: "Person %{person_num}’s working situation must be ‘child under 16’ as you told us they’re under 16" child_under_16: "Person %{person_num}’s working situation must be ‘child under 16’ as you told us they’re under 16"
@ -475,7 +475,7 @@ en:
no_and_dont_know_disabled_needs_conjunction: "No disabled access needs and don’t know disabled access needs cannot be selected together" no_and_dont_know_disabled_needs_conjunction: "No disabled access needs and don’t know disabled access needs cannot be selected together"
prevten: prevten:
non_temp_accommodation: "Answer cannot be non-temporary accommodation as this is a re-let to a tenant who occupied the same property as temporary accommodation" non_temp_accommodation: "Answer cannot be non-temporary accommodation as this is a re-let to a tenant who occupied the same property as temporary accommodation"
over_20_foster_care: "Answer cannot be a children’s home or foster care as the lead tenant is 20 or older" over_25_foster_care: "Answer cannot be a children’s home or foster care as the lead tenant is 26 or older"
male_refuge: "Answer cannot be a refuge as the lead tenant identifies as male" male_refuge: "Answer cannot be a refuge as the lead tenant identifies as male"
internal_transfer: "Answer cannot be %{prevten} as this tenancy is an internal transfer" internal_transfer: "Answer cannot be %{prevten} as this tenancy is an internal transfer"
la_general_needs: la_general_needs:

5
db/migrate/20230713140231_add_total_logs_count_to_bulk_upload.rb

@ -0,0 +1,5 @@
class AddTotalLogsCountToBulkUpload < ActiveRecord::Migration[7.0]
def change
add_column :bulk_uploads, :total_logs_count, :integer
end
end

32
db/schema.rb

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do ActiveRecord::Schema[7.0].define(version: 2023_07_13_140231) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -40,6 +40,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.text "filename" t.text "filename"
t.integer "needstype" t.integer "needstype"
t.text "choice" t.text "choice"
t.integer "total_logs_count"
t.index ["identifier"], name: "index_bulk_uploads_on_identifier", unique: true t.index ["identifier"], name: "index_bulk_uploads_on_identifier", unique: true
t.index ["user_id"], name: "index_bulk_uploads_on_user_id" t.index ["user_id"], name: "index_bulk_uploads_on_user_id"
end end
@ -191,14 +192,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.integer "hb" t.integer "hb"
t.integer "hbrentshortfall" t.integer "hbrentshortfall"
t.integer "property_relet" t.integer "property_relet"
t.datetime "mrcdate" t.datetime "mrcdate", precision: nil
t.integer "incref" t.integer "incref"
t.datetime "startdate" t.datetime "startdate", precision: nil
t.integer "armedforces" t.integer "armedforces"
t.integer "first_time_property_let_as_social_housing" t.integer "first_time_property_let_as_social_housing"
t.integer "unitletas" t.integer "unitletas"
t.integer "builtype" t.integer "builtype"
t.datetime "voiddate" t.datetime "voiddate", precision: nil
t.bigint "owning_organisation_id" t.bigint "owning_organisation_id"
t.bigint "managing_organisation_id" t.bigint "managing_organisation_id"
t.integer "renttype" t.integer "renttype"
@ -346,7 +347,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.string "old_id" t.string "old_id"
t.string "old_visible_id" t.string "old_visible_id"
t.string "mobility_type" t.string "mobility_type"
t.datetime "startdate" t.datetime "startdate", precision: nil
t.string "location_admin_district" t.string "location_admin_district"
t.boolean "confirmed" t.boolean "confirmed"
t.index ["old_id"], name: "index_locations_on_old_id", unique: true t.index ["old_id"], name: "index_locations_on_old_id", unique: true
@ -432,8 +433,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.integer "unspecified_units" t.integer "unspecified_units"
t.string "old_org_id" t.string "old_org_id"
t.string "old_visible_id" t.string "old_visible_id"
t.bigint "absorbing_organisation_id"
t.index ["absorbing_organisation_id"], name: "index_organisations_on_absorbing_organisation_id"
t.index ["old_visible_id"], name: "index_organisations_on_old_visible_id", unique: true t.index ["old_visible_id"], name: "index_organisations_on_old_visible_id", unique: true
end end
@ -519,7 +518,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.integer "stairbought" t.integer "stairbought"
t.integer "stairowned" t.integer "stairowned"
t.decimal "mrent", precision: 10, scale: 2 t.decimal "mrent", precision: 10, scale: 2
t.datetime "exdate" t.datetime "exdate", precision: nil
t.integer "exday" t.integer "exday"
t.integer "exmonth" t.integer "exmonth"
t.integer "exyear" t.integer "exyear"
@ -555,7 +554,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.integer "wchair" t.integer "wchair"
t.integer "income2_value_check" t.integer "income2_value_check"
t.integer "armedforcesspouse" t.integer "armedforcesspouse"
t.datetime "hodate" t.datetime "hodate", precision: nil
t.integer "hoday" t.integer "hoday"
t.integer "homonth" t.integer "homonth"
t.integer "hoyear" t.integer "hoyear"
@ -608,9 +607,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.integer "discounted_sale_value_check" t.integer "discounted_sale_value_check"
t.integer "student_not_child_value_check" t.integer "student_not_child_value_check"
t.integer "percentage_discount_value_check" t.integer "percentage_discount_value_check"
t.integer "combined_income_value_check"
t.integer "buyer_livein_value_check" t.integer "buyer_livein_value_check"
t.integer "status_cache", default: 0, null: false t.integer "status_cache", default: 0, null: false
t.integer "combined_income_value_check"
t.datetime "discarded_at" t.datetime "discarded_at"
t.integer "stairowned_value_check" t.integer "stairowned_value_check"
t.integer "creation_method", default: 1 t.integer "creation_method", default: 1
@ -663,8 +662,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.string "name" t.string "name"
t.bigint "organisation_id" t.bigint "organisation_id"
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at", precision: nil
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at", precision: nil
t.string "current_sign_in_ip" t.string "current_sign_in_ip"
t.string "last_sign_in_ip" t.string "last_sign_in_ip"
t.integer "role" t.integer "role"
@ -672,7 +671,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.string "phone" t.string "phone"
t.integer "failed_attempts", default: 0 t.integer "failed_attempts", default: 0
t.string "unlock_token" t.string "unlock_token"
t.datetime "locked_at" t.datetime "locked_at", precision: nil
t.boolean "is_dpo", default: false t.boolean "is_dpo", default: false
t.boolean "is_key_contact", default: false t.boolean "is_key_contact", default: false
t.integer "second_factor_attempts_count", default: 0 t.integer "second_factor_attempts_count", default: 0
@ -680,12 +679,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
t.string "encrypted_otp_secret_key_iv" t.string "encrypted_otp_secret_key_iv"
t.string "encrypted_otp_secret_key_salt" t.string "encrypted_otp_secret_key_salt"
t.string "direct_otp" t.string "direct_otp"
t.datetime "direct_otp_sent_at" t.datetime "direct_otp_sent_at", precision: nil
t.datetime "totp_timestamp", precision: nil t.datetime "totp_timestamp", precision: nil
t.boolean "active", default: true t.boolean "active", default: true
t.string "confirmation_token" t.string "confirmation_token"
t.datetime "confirmed_at" t.datetime "confirmed_at", precision: nil
t.datetime "confirmation_sent_at" t.datetime "confirmation_sent_at", precision: nil
t.string "unconfirmed_email" t.string "unconfirmed_email"
t.boolean "initial_confirmation_sent" t.boolean "initial_confirmation_sent"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
@ -715,7 +714,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_19_150610) do
add_foreign_key "locations", "schemes" add_foreign_key "locations", "schemes"
add_foreign_key "organisation_relationships", "organisations", column: "child_organisation_id" add_foreign_key "organisation_relationships", "organisations", column: "child_organisation_id"
add_foreign_key "organisation_relationships", "organisations", column: "parent_organisation_id" add_foreign_key "organisation_relationships", "organisations", column: "parent_organisation_id"
add_foreign_key "organisations", "organisations", column: "absorbing_organisation_id"
add_foreign_key "sales_logs", "organisations", column: "owning_organisation_id", on_delete: :cascade add_foreign_key "sales_logs", "organisations", column: "owning_organisation_id", on_delete: :cascade
add_foreign_key "schemes", "organisations", column: "owning_organisation_id", on_delete: :cascade add_foreign_key "schemes", "organisations", column: "owning_organisation_id", on_delete: :cascade
add_foreign_key "users", "organisations", on_delete: :cascade add_foreign_key "users", "organisations", on_delete: :cascade

14
spec/features/lettings_log_spec.rb

@ -59,9 +59,17 @@ RSpec.describe "Lettings Log Features" do
context "when filtering logs" do context "when filtering logs" do
let(:user) { create(:user, last_sign_in_at: Time.zone.now) } let(:user) { create(:user, last_sign_in_at: Time.zone.now) }
let(:stock_owner_1) { create(:organisation, name: "stock owner 1") }
let(:stock_owner_2) { create(:organisation, name: "stock owner 2") }
let(:managing_agent_1) { create(:organisation, name: "managing agent 1") }
let(:managing_agent_2) { create(:organisation, name: "managing agent 2") }
context "when I am signed in" do context "when I am signed in" do
before do before do
FactoryBot.create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: stock_owner_1)
FactoryBot.create(:organisation_relationship, child_organisation: user.organisation, parent_organisation: stock_owner_2)
FactoryBot.create(:organisation_relationship, child_organisation: managing_agent_1, parent_organisation: user.organisation)
FactoryBot.create(:organisation_relationship, child_organisation: managing_agent_2, parent_organisation: user.organisation)
visit("/lettings-logs") visit("/lettings-logs")
fill_in("user[email]", with: user.email) fill_in("user[email]", with: user.email)
fill_in("user[password]", with: user.password) fill_in("user[password]", with: user.password)
@ -80,11 +88,15 @@ RSpec.describe "Lettings Log Features" do
check("Not started") check("Not started")
check("In progress") check("In progress")
choose("You") choose("You")
choose("Specific owning organisation")
select(stock_owner_1.name, from: "owning_organisation")
choose("Specific managing organisation")
select(managing_agent_1.name, from: "managing_organisation")
click_button("Apply filters") click_button("Apply filters")
end end
it "displays the filters component with a correct count and clear button" do it "displays the filters component with a correct count and clear button" do
expect(page).to have_content("3 filters applied") expect(page).to have_content("5 filters applied")
expect(page).to have_content("Clear") expect(page).to have_content("Clear")
end end

5
spec/helpers/filters_helper_spec.rb

@ -222,7 +222,7 @@ RSpec.describe FiltersHelper do
"assigned_to" => "all", "assigned_to" => "all",
"status" => [""], "status" => [""],
"years" => [""], "years" => [""],
"organisation" => "all", "organisation_select" => "all",
} }
end end
@ -237,7 +237,8 @@ RSpec.describe FiltersHelper do
"assigned_to" => "all", "assigned_to" => "all",
"status" => %w[in_progress completed], "status" => %w[in_progress completed],
"years" => [""], "years" => [""],
"organisation" => 2, "organisation_select" => "specific_org",
"managing_organisation" => 2,
} }
end end

8
spec/models/validations/household_validations_spec.rb

@ -624,15 +624,15 @@ RSpec.describe Validations::HouseholdValidations do
end end
end end
context "when the lead tenant is over 20" do context "when the lead tenant is over 25" do
it "cannot be children's home/foster care" do it "cannot be children's home/foster care" do
record.prevten = 13 record.prevten = 13
record.age1 = 21 record.age1 = 26
household_validator.validate_previous_housing_situation(record) household_validator.validate_previous_housing_situation(record)
expect(record.errors["prevten"]) expect(record.errors["prevten"])
.to include(match I18n.t("validations.household.prevten.over_20_foster_care")) .to include(match I18n.t("validations.household.prevten.over_25_foster_care"))
expect(record.errors["age1"]) expect(record.errors["age1"])
.to include(match I18n.t("validations.household.age.lead.over_20")) .to include(match I18n.t("validations.household.age.lead.over_25"))
end end
end end

4
spec/requests/bulk_upload_lettings_resume_controller_spec.rb

@ -25,7 +25,7 @@ RSpec.describe BulkUploadLettingsResumeController, type: :request do
expect(response.body).to include("Bulk upload for lettings") expect(response.body).to include("Bulk upload for lettings")
expect(response.body).to include("2022/23") expect(response.body).to include("2022/23")
expect(response.body).to include("How would you like to fix 2 errors?") expect(response.body).to include("How would you like to fix the errors?")
expect(response.body).to include(bulk_upload.filename) expect(response.body).to include(bulk_upload.filename)
expect(response.body).not_to include("Cancel") expect(response.body).not_to include("Cancel")
end end
@ -106,7 +106,7 @@ RSpec.describe BulkUploadLettingsResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Are you sure") expect(response.body).to include("You have chosen to upload all logs from this bulk upload.")
end end
it "sets no cache headers" do it "sets no cache headers" do

6
spec/requests/bulk_upload_lettings_soft_validations_check_controller_spec.rb

@ -2,7 +2,7 @@ require "rails_helper"
RSpec.describe BulkUploadLettingsSoftValidationsCheckController, type: :request do RSpec.describe BulkUploadLettingsSoftValidationsCheckController, type: :request do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:bulk_upload) { create(:bulk_upload, :lettings, user:, bulk_upload_errors:) } let(:bulk_upload) { create(:bulk_upload, :lettings, user:, bulk_upload_errors:, total_logs_count: 2) }
let(:bulk_upload_errors) { create_list(:bulk_upload_error, 2) } let(:bulk_upload_errors) { create_list(:bulk_upload_error, 2) }
before do before do
@ -98,8 +98,8 @@ RSpec.describe BulkUploadLettingsSoftValidationsCheckController, type: :request
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Are you sure you want to upload all logs from this bulk upload?") expect(response.body).to include("You have chosen to upload all logs from this bulk upload.")
expect(response.body).to include("There are 2 logs in this bulk upload, and 2 unexpected answers will be marked as correct.") expect(response.body).to include("You will upload 2 logs. There are unexpected answers in 2 logs, and 2 unexpected answers in total. These unexpected answers will be marked as correct.")
expect(response.body).not_to include("You’ve successfully uploaded") expect(response.body).not_to include("You’ve successfully uploaded")
end end
end end

4
spec/requests/bulk_upload_sales_resume_controller_spec.rb

@ -25,7 +25,7 @@ RSpec.describe BulkUploadSalesResumeController, type: :request do
expect(response.body).to include("Bulk upload for sales") expect(response.body).to include("Bulk upload for sales")
expect(response.body).to include("2022/23") expect(response.body).to include("2022/23")
expect(response.body).to include("How would you like to fix 2 errors?") expect(response.body).to include("How would you like to fix the errors?")
expect(response.body).to include(bulk_upload.filename) expect(response.body).to include(bulk_upload.filename)
expect(response.body).not_to include("Cancel") expect(response.body).not_to include("Cancel")
end end
@ -106,7 +106,7 @@ RSpec.describe BulkUploadSalesResumeController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Are you sure") expect(response.body).to include("You have chosen to upload all logs from this bulk upload.")
end end
it "sets no cache headers" do it "sets no cache headers" do

6
spec/requests/bulk_upload_sales_soft_validations_check_controller_spec.rb

@ -2,7 +2,7 @@ require "rails_helper"
RSpec.describe BulkUploadSalesSoftValidationsCheckController, type: :request do RSpec.describe BulkUploadSalesSoftValidationsCheckController, type: :request do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:bulk_upload) { create(:bulk_upload, :sales, user:, bulk_upload_errors:) } let(:bulk_upload) { create(:bulk_upload, :sales, user:, bulk_upload_errors:, total_logs_count: 2) }
let(:bulk_upload_errors) { create_list(:bulk_upload_error, 2) } let(:bulk_upload_errors) { create_list(:bulk_upload_error, 2) }
before do before do
@ -98,8 +98,8 @@ RSpec.describe BulkUploadSalesSoftValidationsCheckController, type: :request do
expect(response).to be_successful expect(response).to be_successful
expect(response.body).to include("Are you sure you want to upload all logs from this bulk upload?") expect(response.body).to include("You have chosen to upload all logs from this bulk upload.")
expect(response.body).to include("There are 2 logs in this bulk upload, and 2 unexpected answers will be marked as correct.") expect(response.body).to include("You will upload 2 logs. There are unexpected answers in 2 logs, and 2 unexpected answers in total. These unexpected answers will be marked as correct.")
expect(response.body).not_to include("You’ve successfully uploaded") expect(response.body).not_to include("You’ve successfully uploaded")
end end
end end

10
spec/requests/lettings_logs_controller_spec.rb

@ -477,6 +477,10 @@ RSpec.describe LettingsLogsController, type: :request do
let!(:included_log) { create(:lettings_log, :in_progress, bulk_upload:, owning_organisation: organisation) } let!(:included_log) { create(:lettings_log, :in_progress, bulk_upload:, owning_organisation: organisation) }
let!(:excluded_log) { create(:lettings_log, :in_progress, owning_organisation: organisation, tenancycode: "fake_code") } let!(:excluded_log) { create(:lettings_log, :in_progress, owning_organisation: organisation, tenancycode: "fake_code") }
before do
create(:bulk_upload_error, bulk_upload:, col: "A", row: 1)
end
it "returns logs only associated with the bulk upload" do it "returns logs only associated with the bulk upload" do
get "/lettings-logs?bulk_upload_id[]=#{bulk_upload.id}" get "/lettings-logs?bulk_upload_id[]=#{bulk_upload.id}"
@ -484,9 +488,9 @@ RSpec.describe LettingsLogsController, type: :request do
expect(page).not_to have_content(excluded_log.tenancycode) expect(page).not_to have_content(excluded_log.tenancycode)
end end
it "displays how many logs remaining to fix" do it "dislays bulk uplaoad header" do
get "/lettings-logs?bulk_upload_id[]=#{bulk_upload.id}" get "/lettings-logs?bulk_upload_id[]=#{bulk_upload.id}"
expect(page).to have_content("You need to fix 1 log") expect(page).to have_content("Fix the errors from this bulk upload")
end end
it "displays filter" do it "displays filter" do
@ -517,7 +521,7 @@ RSpec.describe LettingsLogsController, type: :request do
it "displays card with help info" do it "displays card with help info" do
get "/lettings-logs?bulk_upload_id[]=#{bulk_upload.id}" get "/lettings-logs?bulk_upload_id[]=#{bulk_upload.id}"
expect(page).to have_content("The following logs are from your recent bulk upload") expect(page).to have_content("You have uploaded 1 log. There are errors in 1 log, and 1 error in total. Select the log to fix the errors.")
end end
it "displays meta info about the bulk upload" do it "displays meta info about the bulk upload" do

10
spec/requests/sales_logs_controller_spec.rb

@ -355,6 +355,10 @@ RSpec.describe SalesLogsController, type: :request do
let!(:included_log) { create(:sales_log, :in_progress, bulk_upload:, owning_organisation: organisation) } let!(:included_log) { create(:sales_log, :in_progress, bulk_upload:, owning_organisation: organisation) }
let!(:excluded_log) { create(:sales_log, :in_progress, owning_organisation: organisation) } let!(:excluded_log) { create(:sales_log, :in_progress, owning_organisation: organisation) }
before do
create(:bulk_upload_error, bulk_upload:, col: "A", row: 1)
end
it "returns logs only associated with the bulk upload" do it "returns logs only associated with the bulk upload" do
get "/sales-logs?bulk_upload_id[]=#{bulk_upload.id}" get "/sales-logs?bulk_upload_id[]=#{bulk_upload.id}"
@ -362,9 +366,9 @@ RSpec.describe SalesLogsController, type: :request do
expect(page).not_to have_content(excluded_log.id) expect(page).not_to have_content(excluded_log.id)
end end
it "displays how many logs remaining to fix" do it "dislays bulk upload banner" do
get "/sales-logs?bulk_upload_id[]=#{bulk_upload.id}" get "/sales-logs?bulk_upload_id[]=#{bulk_upload.id}"
expect(page).to have_content("You need to fix 1 log") expect(page).to have_content("Fix the errors from this bulk upload")
end end
it "displays filter" do it "displays filter" do
@ -395,7 +399,7 @@ RSpec.describe SalesLogsController, type: :request do
it "displays card with help info" do it "displays card with help info" do
get "/sales-logs?bulk_upload_id[]=#{bulk_upload.id}" get "/sales-logs?bulk_upload_id[]=#{bulk_upload.id}"
expect(page).to have_content("The following logs are from your recent bulk upload") expect(page).to have_content("You have uploaded 1 log. There are errors in 1 log, and 1 error in total. Select the log to fix the errors.")
end end
it "displays meta info about the bulk upload" do it "displays meta info about the bulk upload" do

4
spec/services/bulk_upload/lettings/validator_spec.rb

@ -65,6 +65,10 @@ RSpec.describe BulkUpload::Lettings::Validator do
it "is valid" do it "is valid" do
expect(validator).to be_valid expect(validator).to be_valid
end end
it "returns correct total logs count" do
expect(validator.total_logs_count).to be(1)
end
end end
context "and file has too few valid headers" do context "and file has too few valid headers" do

10
spec/services/bulk_upload/processor_spec.rb

@ -33,6 +33,7 @@ RSpec.describe BulkUpload::Processor do
BulkUpload::Lettings::Validator, BulkUpload::Lettings::Validator,
invalid?: true, invalid?: true,
call: nil, call: nil,
total_logs_count: 1,
errors: [], errors: [],
) )
end end
@ -58,6 +59,13 @@ RSpec.describe BulkUpload::Processor do
expect(mock_validator).not_to have_received(:call) expect(mock_validator).not_to have_received(:call)
end end
it "sets total number of logs on bulk upload" do
processor.call
bulk_upload.reload
expect(bulk_upload.total_logs_count).to eq(1)
end
end end
context "when the bulk upload processing throws an error" do context "when the bulk upload processing throws an error" do
@ -74,6 +82,7 @@ RSpec.describe BulkUpload::Processor do
instance_double( instance_double(
BulkUpload::Lettings::Validator, BulkUpload::Lettings::Validator,
invalid?: false, invalid?: false,
total_logs_count: 1,
) )
end end
@ -119,6 +128,7 @@ RSpec.describe BulkUpload::Processor do
BulkUpload::Lettings::Validator, BulkUpload::Lettings::Validator,
invalid?: false, invalid?: false,
call: nil, call: nil,
total_logs_count: 1,
any_setup_errors?: true, any_setup_errors?: true,
) )
end end

27
spec/services/bulk_upload/sales/validator_spec.rb

@ -246,4 +246,31 @@ RSpec.describe BulkUpload::Sales::Validator do
end end
end end
end end
describe "#total_logs_count?" do
around do |example|
Timecop.freeze(Time.zone.local(2023, 2, 22)) do
Singleton.__init__(FormHandler)
example.run
end
Timecop.return
Singleton.__init__(FormHandler)
end
context "when all logs are valid" do
let(:target_path) { file_fixture("completed_2022_23_sales_bulk_upload.csv") }
before do
target_array = File.open(target_path).readlines
target_array[0..118].each do |line|
file.write line
end
file.rewind
end
it "returns correct total logs count" do
expect(validator.total_logs_count).to be(1)
end
end
end
end end

8
spec/services/imports/lettings_logs_import_service_spec.rb

@ -296,16 +296,16 @@ RSpec.describe Imports::LettingsLogsImportService do
end end
end end
context "and an lead tenant must be under 20 if childrens home or foster care" do context "and an lead tenant must be under 26 if childrens home or foster care" do
before do before do
lettings_log_xml.at_xpath("//meta:status").content = "submitted" lettings_log_xml.at_xpath("//meta:status").content = "submitted"
lettings_log_xml.at_xpath("//xmlns:Q11").content = "13" lettings_log_xml.at_xpath("//xmlns:Q11").content = "13"
lettings_log_xml.at_xpath("//xmlns:P1Age").content = "22" lettings_log_xml.at_xpath("//xmlns:P1Age").content = "26"
end end
it "intercepts the relevant validation error" do it "intercepts the relevant validation error" do
expect(logger).to receive(:warn).with(/Removing prevten with error: Answer cannot be a children’s home or foster care as the lead tenant is 20 or older/) expect(logger).to receive(:warn).with(/Removing prevten with error: Answer cannot be a children’s home or foster care as the lead tenant is 26 or older/)
expect(logger).to receive(:warn).with(/Removing age1 with error: Answer cannot be a children’s home or foster care as the lead tenant is 20 or older/) expect(logger).to receive(:warn).with(/Removing age1 with error: Answer cannot be a children’s home or foster care as the lead tenant is 26 or older/)
expect { lettings_log_service.send(:create_log, lettings_log_xml) } expect { lettings_log_service.send(:create_log, lettings_log_xml) }
.not_to raise_error .not_to raise_error
end end

Loading…
Cancel
Save