From c3b85f2b5036b25b87b9261ed1e14ccb5af4c8c3 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:26:40 +0100 Subject: [PATCH 1/4] CLDC-3411: Correct 24/25 bulk upload error messages on lettings and sales (#2553) --- app/models/form/question.rb | 3 ++- .../bulk_upload/lettings/year2024/row_parser.rb | 10 ++++------ config/locales/en.yml | 8 ++++---- .../models/form/lettings/questions/declaration_spec.rb | 4 ++-- .../models/form/sales/questions/privacy_notice_spec.rb | 8 ++++---- .../bulk_upload/lettings/year2023/row_parser_spec.rb | 2 +- .../bulk_upload/lettings/year2024/row_parser_spec.rb | 2 +- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/app/models/form/question.rb b/app/models/form/question.rb index 960af8909..1fbced841 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -208,7 +208,8 @@ class Form::Question end def unanswered_error_message - I18n.t("validations.not_answered", question: error_display_label.downcase) + question_text = error_display_label.presence || "this question" + I18n.t("validations.not_answered", question: question_text.downcase) end def suffix_label(log) diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index 2e54f5c3f..e523c11c4 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb @@ -44,7 +44,7 @@ class BulkUpload::Lettings::Year2024::RowParser field_39: "If 'Other', what is the type of tenancy?", field_40: "What is the length of the fixed-term tenancy to the nearest year?", field_41: "Is this letting sheltered accommodation?", - field_15: "Has tenant seen the DLUHC privacy notice?", + field_15: "Has tenant seen the MHCLG privacy notice?", field_42: "What is the lead tenant's age?", field_43: "Which of these best describes the lead tenant's gender identity?", field_44: "Which of these best describes the lead tenant's ethnic background?", @@ -806,16 +806,14 @@ private if setup_question?(question) fields.each do |field| - if errors.select { |e| fields.include?(e.attribute) }.none? - question_text = question.error_display_label.presence || "this question" - errors.add(field, I18n.t("validations.not_answered", question: question_text.downcase), category: :setup) if field.present? + if errors.select { |e| fields.include?(e.attribute) }.none? && field.present? + errors.add(field, question.unanswered_error_message, category: :setup) end end else fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - question_text = question.error_display_label.presence || "this question" - errors.add(field, I18n.t("validations.not_answered", question: question_text.downcase)) + errors.add(field, question.unanswered_error_message) end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index b6ba761f2..4dfe72872 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -589,13 +589,13 @@ en: declaration: missing: - pre_2024: "You must show the MHCLG privacy notice to the tenant before you can submit this log." - post_2024: "You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log." + pre_2024: "You must show the MHCLG privacy notice to the tenant before you can submit this log" + post_2024: "You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log" privacynotice: missing: - pre_2024: "You must show the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log." - post_2024: "You must show or give access to the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log." + pre_2024: "You must show the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log" + post_2024: "You must show or give access to the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log" scheme: toggle_date: diff --git a/spec/models/form/lettings/questions/declaration_spec.rb b/spec/models/form/lettings/questions/declaration_spec.rb index ab9bcebef..7e4d47249 100644 --- a/spec/models/form/lettings/questions/declaration_spec.rb +++ b/spec/models/form/lettings/questions/declaration_spec.rb @@ -63,7 +63,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the tenant before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the tenant before you can submit this log") end end @@ -87,7 +87,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log") end end end diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb index 4be918c5c..bbaabb6a5 100644 --- a/spec/models/form/sales/questions/privacy_notice_spec.rb +++ b/spec/models/form/sales/questions/privacy_notice_spec.rb @@ -60,7 +60,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyer before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyer before you can submit this log") end end @@ -78,7 +78,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyers before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show the MHCLG privacy notice to the buyers before you can submit this log") end end end @@ -100,7 +100,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyer before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyer before you can submit this log") end end @@ -118,7 +118,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyers before you can submit this log.") + expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyers before you can submit this log") end end end diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index a8cfd0a79..e38396328 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -686,7 +686,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do it "cannot be nulled" do parser.valid? - expect(parser.errors[:field_45]).to eq(["You must show the MHCLG privacy notice to the tenant before you can submit this log."]) + expect(parser.errors[:field_45]).to eq(["You must show the MHCLG privacy notice to the tenant before you can submit this log"]) end end end diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index 7cae5eeae..405bb292d 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -747,7 +747,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "cannot be nulled" do parser.valid? - expect(parser.errors[:field_15]).to eq(["You must answer tenant has seen the privacy notice"]) + expect(parser.errors[:field_15]).to eq(["You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log"]) end end From 1da04df30fe63890fa69c319d1db646ea4a83957 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Thu, 8 Aug 2024 09:50:47 +0100 Subject: [PATCH 2/4] CLDC-3411 correct 24 25 bulk upload error messages on lettings and sales (#2556) * Update error messages and sales parser --- app/services/bulk_upload/sales/year2024/row_parser.rb | 4 ++-- config/locales/en.yml | 4 ++-- .../form/lettings/questions/declaration_spec.rb | 2 +- .../form/sales/questions/privacy_notice_spec.rb | 4 ++-- .../bulk_upload/lettings/year2024/row_parser_spec.rb | 2 +- .../bulk_upload/sales/year2024/row_parser_spec.rb | 11 ++++++++++- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/services/bulk_upload/sales/year2024/row_parser.rb b/app/services/bulk_upload/sales/year2024/row_parser.rb index 68f638e17..d39715f30 100644 --- a/app/services/bulk_upload/sales/year2024/row_parser.rb +++ b/app/services/bulk_upload/sales/year2024/row_parser.rb @@ -1364,13 +1364,13 @@ private if setup_question?(question) fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - errors.add(field, I18n.t("validations.not_answered", question: question.error_display_label&.downcase), category: :setup) + errors.add(field, question.unanswered_error_message, category: :setup) end end else fields.each do |field| unless errors.any? { |e| fields.include?(e.attribute) } - errors.add(field, I18n.t("validations.not_answered", question: question.error_display_label&.downcase)) + errors.add(field, question.unanswered_error_message) end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 4dfe72872..a53b375fe 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -590,12 +590,12 @@ en: declaration: missing: pre_2024: "You must show the MHCLG privacy notice to the tenant before you can submit this log" - post_2024: "You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log" + post_2024: "You must show or give the tenant access to the MHCLG privacy notice before you can submit this log" privacynotice: missing: pre_2024: "You must show the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log" - post_2024: "You must show or give access to the MHCLG privacy notice to the %{buyer_or_buyers} before you can submit this log" + post_2024: "You must show or give the %{buyer_or_buyers} access to the MHCLG privacy notice before you can submit this log" scheme: toggle_date: diff --git a/spec/models/form/lettings/questions/declaration_spec.rb b/spec/models/form/lettings/questions/declaration_spec.rb index 7e4d47249..c64e7f3c8 100644 --- a/spec/models/form/lettings/questions/declaration_spec.rb +++ b/spec/models/form/lettings/questions/declaration_spec.rb @@ -87,7 +87,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log") + expect(question.unanswered_error_message).to eq("You must show or give the tenant access to the MHCLG privacy notice before you can submit this log") end end end diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb index bbaabb6a5..9fb81057a 100644 --- a/spec/models/form/sales/questions/privacy_notice_spec.rb +++ b/spec/models/form/sales/questions/privacy_notice_spec.rb @@ -100,7 +100,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyer before you can submit this log") + expect(question.unanswered_error_message).to eq("You must show or give the buyer access to the MHCLG privacy notice before you can submit this log") end end @@ -118,7 +118,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show or give access to the MHCLG privacy notice to the buyers before you can submit this log") + expect(question.unanswered_error_message).to eq("You must show or give the buyers access to the MHCLG privacy notice before you can submit this log") end end end diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index 405bb292d..25529cc19 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -747,7 +747,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do it "cannot be nulled" do parser.valid? - expect(parser.errors[:field_15]).to eq(["You must show or give access to the MHCLG privacy notice to the tenant before you can submit this log"]) + expect(parser.errors[:field_15]).to eq(["You must show or give the tenant access to the MHCLG privacy notice before you can submit this log"]) end end diff --git a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb index 115995f3e..656ff7a2f 100644 --- a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb @@ -1042,12 +1042,21 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do describe "#field_18" do # data protection let(:attributes) { setup_section_params.merge({ field_18: nil }) } + before do + parser.valid? + end + context "when not answered" do it "returns a setup error" do - parser.valid? expect(parser.errors.where(:field_18, category: :setup)).to be_present end end + + context "when the privacy notice is not accepted" do + it "cannot be nulled" do + expect(parser.errors[:field_18]).to eq(["You must show or give the buyer access to the MHCLG privacy notice before you can submit this log"]) + end + end end [ From 979e2a6ba229ebf14239296644b143af4bddf45f Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:28:37 +0100 Subject: [PATCH 3/4] Filter out location questions before checking the routing (#2557) --- app/models/lettings_log.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index eab05c997..e7a72350d 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -581,14 +581,22 @@ class LettingsLog < Log def non_location_setup_questions_completed? form.setup_sections.all? do |section| section.subsections.all? do |subsection| - relevant_qs = subsection.applicable_questions(self).reject { |q| optional_fields.include?(q.id) || %w[scheme_id location_id].include?(q.id) } - relevant_qs.all? do |question| + relevant_qs = subsection.questions.reject { |q| optional_fields.include?(q.id) || %w[scheme_id location_id].include?(q.id) } + relevant_applicable_qs = select_applicable_questions(self, relevant_qs) + relevant_applicable_qs.all? do |question| question.completed?(self) end end end end + # this is the same as the subsection method, but only for given questions + def select_applicable_questions(log, questions) + questions.select do |q| + (q.displayed_to_user?(log) && !q.derived?(log)) || q.is_derived_or_has_inferred_check_answers_value?(log) + end + end + def resolve! update(unresolved: false) end From c7bf7a037d451bda8f8ec8e10f313c3f5b19b30d Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:54:39 +0100 Subject: [PATCH 4/4] CLDC-2588-Separate soft and hard validation errors in bulk upload (#2545) * Separate soft and hard validation errors in bulk upload --- .../bulk_upload_error_row_component.html.erb | 50 ++++++++++++++++--- app/frontend/styles/application.scss | 14 ++++++ .../summary.html.erb | 2 +- .../summary.html.erb | 2 +- .../bulk_upload_error_row_component_spec.rb | 49 ++++++++++++++++++ .../show.html.erb_spec.rb | 2 +- .../summary.html.erb_spec.rb | 2 +- .../show.html.erb_spec.rb | 3 +- .../summary.html.erb_spec.rb | 2 +- 9 files changed, 112 insertions(+), 14 deletions(-) diff --git a/app/components/bulk_upload_error_row_component.html.erb b/app/components/bulk_upload_error_row_component.html.erb index 907c73298..4e9ff1390 100644 --- a/app/components/bulk_upload_error_row_component.html.erb +++ b/app/components/bulk_upload_error_row_component.html.erb @@ -1,13 +1,16 @@
<% if lettings? %> -

Row <%= row %> <%= tenant_code_html %> <%= property_ref_html %>

+

Row <%= row %> <%= tenant_code_html %> <%= property_ref_html %>

<% else %> -

Row <%= row %> <%= purchaser_code_html %>

+

Row <%= row %> <%= purchaser_code_html %>

<% end %>
+ <% potential_errors, critical_errors = bulk_upload_errors.partition { |error| error.category == "soft_validation" } %> +

Critical errors

+

These errors must be fixed to complete your logs.

<%= govuk_table do |table| %> <%= table.with_head do |head| %> <% head.with_row do |row| %> @@ -18,16 +21,49 @@ <% end %> <%= table.with_body do |body| %> - <% bulk_upload_errors.each do |error| %> + <% critical_errors.each do |error| %> <% body.with_row do |row| %> - <% row.with_cell(header: true, text: error.cell) %> - <% row.with_cell(text: question_for_field(error.field)) %> - <% row.with_cell(text: error.error) %> - <% row.with_cell(text: error.field.humanize) %> + <% row.with_cell(text: error.cell) %> + <% row.with_cell(text: question_for_field(error.field)) %> + <% row.with_cell(text: error.error, html_attributes: { class: "govuk-!-font-weight-bold" }) %> + <% row.with_cell(text: error.field.humanize) %> <% end %> <% end %> <% end %> <% end %> <% end %> + + <% if potential_errors.any? %> +

Potential errors

+

The following groups of cells might have conflicting data. Check the answers and fix any incorrect data.

If the answers are correct, fix the critical errors and reupload the file. You'll need to confirm that the following data is correct when the file only contains potential errors.

+ <%= govuk_table do |table| %> + <%= table.with_head do |head| %> + <% head.with_row do |row| %> + <% row.with_cell(header: true, text: "Cell") %> + <% row.with_cell(header: true, text: "Question") %> + <% row.with_cell(header: true, text: "Potential error") %> + <% row.with_cell(header: true, text: "Specification") %> + <% end %> + <% end %> + + <%= table.with_body do |body| %> + <% potential_errors.group_by(&:error).each do |error_message, errors| %> + <% errors.each_with_index do |error, index| %> + <% row_class = "grouped-rows" %> + <% row_class += " first-row" if index.zero? %> + <% row_class += " last-row" if index == errors.size - 1 %> + <% body.with_row(html_attributes: { class: row_class }) do |row| %> + <% row.with_cell(text: error.cell) %> + <% row.with_cell(text: question_for_field(error.field)) %> + <% if index == 0 %> + <% row.with_cell(text: error_message, rowspan: errors.size, html_attributes: { class: "govuk-!-font-weight-bold grouped-multirow-cell" }) %> + <% end %> + <% row.with_cell(text: error.field.humanize) %> + <% end %> + <% end %> + <% end %> + <% end %> + <% end %> + <% end %>
diff --git a/app/frontend/styles/application.scss b/app/frontend/styles/application.scss index a81214894..62d4e932e 100644 --- a/app/frontend/styles/application.scss +++ b/app/frontend/styles/application.scss @@ -81,3 +81,17 @@ $govuk-breakpoints: ( .govuk-footer { border-top: govuk-spacing(2) solid $govuk-brand-colour; } + +.grouped-rows td { + border-top: none; + border-bottom: none; +} + +.grouped-rows.first-row td { + border-top: 1px solid #b1b4b6; +} + +.grouped-rows.last-row td, +.grouped-rows .grouped-multirow-cell { + border-bottom: 1px solid #b1b4b6; +} diff --git a/app/views/bulk_upload_lettings_results/summary.html.erb b/app/views/bulk_upload_lettings_results/summary.html.erb index d6a1127af..8c36af632 100644 --- a/app/views/bulk_upload_lettings_results/summary.html.erb +++ b/app/views/bulk_upload_lettings_results/summary.html.erb @@ -4,7 +4,7 @@

Fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> and upload file again

- We could not create logs from your bulk upload. Below is a list of everything that you need to fix your spreadsheet. You can download the <%= govuk_link_to "specification", Forms::BulkUploadLettings::PrepareYourFile.new(year: @bulk_upload.year).specification_path, target: "_blank" %> to help you fix the cells in your CSV file. + We could not create logs from your bulk upload because of the following errors. Download the <%= govuk_link_to "specification", Forms::BulkUploadLettings::PrepareYourFile.new(year: @bulk_upload.year).specification_path, target: "_blank" %> to help you fix the cells in your CSV file.

diff --git a/app/views/bulk_upload_sales_results/summary.html.erb b/app/views/bulk_upload_sales_results/summary.html.erb index 8fd6c22ed..af504acbd 100644 --- a/app/views/bulk_upload_sales_results/summary.html.erb +++ b/app/views/bulk_upload_sales_results/summary.html.erb @@ -4,7 +4,7 @@

Fix <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> and upload file again

- We could not create logs from your bulk upload. Below is a list of everything that you need to fix your spreadsheet. You can download the <%= govuk_link_to "specification", Forms::BulkUploadSales::PrepareYourFile.new(year: @bulk_upload.year).specification_path, target: "_blank" %> to help you fix the cells in your CSV file. + We could not create logs from your bulk upload because of the following errors. Download the <%= govuk_link_to "specification", Forms::BulkUploadSales::PrepareYourFile.new(year: @bulk_upload.year).specification_path, target: "_blank" %> to help you fix the cells in your CSV file.

diff --git a/spec/components/bulk_upload_error_row_component_spec.rb b/spec/components/bulk_upload_error_row_component_spec.rb index 01af041cb..b593a0048 100644 --- a/spec/components/bulk_upload_error_row_component_spec.rb +++ b/spec/components/bulk_upload_error_row_component_spec.rb @@ -108,4 +108,53 @@ RSpec.describe BulkUploadErrorRowComponent, type: :component do expect(result).to have_content(expected) end end + + context "when there are potential errors" do + let(:row) { rand(9_999) } + let(:tenant_code) { SecureRandom.hex(4) } + let(:property_ref) { SecureRandom.hex(4) } + let(:purchaser_code) { nil } + let(:category) { "soft_validation" } + let(:field_46) { 40 } + let(:field_50) { 5 } + let(:error) { "You told us this person is aged 40 years and retired." } + let(:bulk_upload) { create(:bulk_upload, :lettings) } + let(:bulk_upload_errors) do + [ + FactoryBot.build( + :bulk_upload_error, + bulk_upload:, + row:, + tenant_code:, + property_ref:, + purchaser_code:, + field: :field_46, + error:, + category:, + ), + FactoryBot.build( + :bulk_upload_error, + bulk_upload:, + row:, + tenant_code:, + property_ref:, + purchaser_code:, + field: :field_50, + error:, + category:, + ), + ] + end + + it "renders the potential errors section" do + result = render_inline(described_class.new(bulk_upload_errors:)) + expect(result).to have_content("Potential errors") + end + + it "renders the potential error message" do + expected = error + result = render_inline(described_class.new(bulk_upload_errors:)) + expect(result).to have_content(expected, count: 1) + end + end end diff --git a/spec/views/bulk_upload_lettings_results/show.html.erb_spec.rb b/spec/views/bulk_upload_lettings_results/show.html.erb_spec.rb index 3dea3ce92..637dfa3a9 100644 --- a/spec/views/bulk_upload_lettings_results/show.html.erb_spec.rb +++ b/spec/views/bulk_upload_lettings_results/show.html.erb_spec.rb @@ -33,7 +33,7 @@ RSpec.describe "bulk_upload_lettings_results/show.html.erb" do fragment = Capybara::Node::Simple.new(rendered) - expect(fragment.find_css("table tbody th").map(&:inner_text)).to eql(%w[Z100 AA100]) + expect(fragment.find_css("table tbody td").map(&:inner_text).values_at(0, 4)).to eql(%w[Z100 AA100]) end end end diff --git a/spec/views/bulk_upload_lettings_results/summary.html.erb_spec.rb b/spec/views/bulk_upload_lettings_results/summary.html.erb_spec.rb index 05e2dce85..ac0c1f82d 100644 --- a/spec/views/bulk_upload_lettings_results/summary.html.erb_spec.rb +++ b/spec/views/bulk_upload_lettings_results/summary.html.erb_spec.rb @@ -33,7 +33,7 @@ RSpec.describe "bulk_upload_lettings_results/summary.html.erb" do fragment = Capybara::Node::Simple.new(rendered) - expect(fragment.find_css("table tbody th").map(&:inner_text)).to eql(%w[Z100 AA100]) + expect(fragment.find_css("table tbody td").map(&:inner_text).values_at(0, 4)).to eql(%w[Z100 AA100]) end end end diff --git a/spec/views/bulk_upload_sales_results/show.html.erb_spec.rb b/spec/views/bulk_upload_sales_results/show.html.erb_spec.rb index 785d830b3..dc6751dc8 100644 --- a/spec/views/bulk_upload_sales_results/show.html.erb_spec.rb +++ b/spec/views/bulk_upload_sales_results/show.html.erb_spec.rb @@ -32,8 +32,7 @@ RSpec.describe "bulk_upload_sales_results/show.html.erb" do render fragment = Capybara::Node::Simple.new(rendered) - - expect(fragment.find_css("table tbody th").map(&:inner_text)).to eql(%w[Z100 AA100]) + expect(fragment.find_css("table tbody td").map(&:inner_text).values_at(0, 4)).to eql(%w[Z100 AA100]) end end end diff --git a/spec/views/bulk_upload_sales_results/summary.html.erb_spec.rb b/spec/views/bulk_upload_sales_results/summary.html.erb_spec.rb index 6c00e5adf..b3d9aa006 100644 --- a/spec/views/bulk_upload_sales_results/summary.html.erb_spec.rb +++ b/spec/views/bulk_upload_sales_results/summary.html.erb_spec.rb @@ -33,7 +33,7 @@ RSpec.describe "bulk_upload_sales_results/summary.html.erb" do fragment = Capybara::Node::Simple.new(rendered) - expect(fragment.find_css("table tbody th").map(&:inner_text)).to eql(%w[Z100 AA100]) + expect(fragment.find_css("table tbody td").map(&:inner_text).values_at(0, 4)).to eql(%w[Z100 AA100]) end end end