From 0a64b474a930754a9211e9b0528567c1b13e29d6 Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 27 Sep 2022 11:03:59 +0100 Subject: [PATCH] Add hidden_in_check_answers --- app/models/form/sales/questions/nationality1.rb | 11 +++++++++-- spec/models/form/sales/questions/nationality1_spec.rb | 10 ++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/models/form/sales/questions/nationality1.rb b/app/models/form/sales/questions/nationality1.rb index 919230582..737bfc01e 100644 --- a/app/models/form/sales/questions/nationality1.rb +++ b/app/models/form/sales/questions/nationality1.rb @@ -11,13 +11,20 @@ class Form::Sales::Questions::Nationality1 < ::Form::Question @conditional_for = { "othernational" => [12], } + @hidden_in_check_answers = { + "depends_on" => [ + { + "national" => 12, + }, + ], + } end ANSWER_OPTIONS = { "18" => { "value" => "United Kingdom" }, "17" => { "value" => "Republic of Ireland" }, "19" => { "value" => "European Economic Area (EEA), excluding ROI" }, - "12" => { "value" => "Other " }, - "13" => { "value" => "Buyer prefers not to say " }, + "12" => { "value" => "Other" }, + "13" => { "value" => "Buyer prefers not to say" }, }.freeze end diff --git a/spec/models/form/sales/questions/nationality1_spec.rb b/spec/models/form/sales/questions/nationality1_spec.rb index 118c22f5f..e3d8f832b 100644 --- a/spec/models/form/sales/questions/nationality1_spec.rb +++ b/spec/models/form/sales/questions/nationality1_spec.rb @@ -50,4 +50,14 @@ RSpec.describe Form::Sales::Questions::Nationality1, type: :model do "othernational" => [12], }) end + + it "has correct hidden in check answers" do + expect(question.hidden_in_check_answers).to eq({ + "depends_on" => [ + { + "national" => 12, + }, + ], + }) + end end