Browse Source

Display the correct error for privacy notice and display the partial guidance at the top by default

pull/1098/head
Kat 4 years ago
parent
commit
98a10cc3ae
  1. 3
      app/models/form/question.rb
  2. 1
      app/models/form/sales/questions/privacy_notice.rb
  3. 3
      config/locales/en.yml
  4. 4
      spec/models/form/sales/questions/privacy_notice_spec.rb

3
app/models/form/question.rb

@ -14,11 +14,11 @@ class Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
@id = id @id = id
@page = page @page = page
@guidance_position = GuidancePosition::TOP
if hsh if hsh
@check_answer_label = hsh["check_answer_label"] @check_answer_label = hsh["check_answer_label"]
@header = hsh["header"] @header = hsh["header"]
@guidance_partial = hsh["guidance_partial"] @guidance_partial = hsh["guidance_partial"]
@guidance_position = GuidancePosition::TOP
@hint_text = hsh["hint_text"] @hint_text = hsh["hint_text"]
@type = hsh["type"] @type = hsh["type"]
@min = hsh["min"] @min = hsh["min"]
@ -206,6 +206,7 @@ class Form::Question
def unanswered_error_message def unanswered_error_message
return I18n.t("validations.declaration.missing") if id == "declaration" return I18n.t("validations.declaration.missing") if id == "declaration"
return I18n.t("validations.privacynotice.missing") if id == "privacynotice"
I18n.t("validations.not_answered", question: display_label.downcase) I18n.t("validations.not_answered", question: display_label.downcase)
end end

1
app/models/form/sales/questions/privacy_notice.rb

@ -6,7 +6,6 @@ class Form::Sales::Questions::PrivacyNotice < ::Form::Question
@header = "Declaration" @header = "Declaration"
@type = "checkbox" @type = "checkbox"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@guidance_position = GuidancePosition::TOP
@guidance_partial = "privacy_notice_buyer" @guidance_partial = "privacy_notice_buyer"
end end

3
config/locales/en.yml

@ -383,6 +383,9 @@ en:
declaration: declaration:
missing: "You must show the DLUHC privacy notice to the tenant before you can submit this log." missing: "You must show the DLUHC privacy notice to the tenant before you can submit this log."
privacynotice:
missing: "You must show the DLUHC privacy notice to the buyer before you can submit this log."
scheme: scheme:
toggle_date: toggle_date:

4
spec/models/form/sales/questions/privacy_notice_spec.rb

@ -40,4 +40,8 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
"privacynotice" => { "value" => "The buyer has seen the DLUHC privacy notice" }, "privacynotice" => { "value" => "The buyer has seen the DLUHC privacy notice" },
}) })
end end
it "returns correct unanswered_error_message" do
expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the buyer before you can submit this log.")
end
end end

Loading…
Cancel
Save