From 12b3ef25a25283544806fa3645e25fde7795321d Mon Sep 17 00:00:00 2001 From: Samuel Culley Date: Thu, 17 Apr 2025 14:50:07 +0100 Subject: [PATCH] Change value sent for 'None of the above' option for conditions --- app/models/condition.rb | 2 +- spec/models/condition_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/condition.rb b/app/models/condition.rb index 6ff32c9f..3c738b59 100644 --- a/app/models/condition.rb +++ b/app/models/condition.rb @@ -45,7 +45,7 @@ def warning_answer_doesnt_exist return nil if has_precondition? && answer_value.nil? answer_options = check_page&.answer_settings&.dig("selection_options")&.pluck("name") - return nil if answer_options.blank? || answer_options.include?(answer_value) || answer_value == :none_of_the_above.to_s && check_page.is_optional? + return nil if answer_options.blank? || answer_options.include?(answer_value) || answer_value == "None of the above" && check_page.is_optional? { name: "answer_value_doesnt_exist" } end diff --git a/spec/models/condition_spec.rb b/spec/models/condition_spec.rb index a399c958..11e46107 100644 --- a/spec/models/condition_spec.rb +++ b/spec/models/condition_spec.rb @@ -189,7 +189,7 @@ end context "when answer_value is 'None of the above" do - let(:condition) { create :condition, routing_page_id: check_page.id, check_page_id: check_page.id, goto_page_id: goto_page.id, answer_value: :none_of_the_above.to_s } + let(:condition) { create :condition, routing_page_id: check_page.id, check_page_id: check_page.id, goto_page_id: goto_page.id, answer_value: "None of the above" } let(:check_page) { create :page, :with_selections_settings, form:, is_optional: } context "and routing page has 'None of the above' as an option" do