From 5bc82497104d743b6c1ff5a0652fc88df33e9c5f Mon Sep 17 00:00:00 2001 From: Stephen Daly Date: Mon, 22 Jun 2026 10:38:21 +0100 Subject: [PATCH] Revert "Add backwards compatibility for old none of the above value" This reverts commit 8550e8dc42600d2c820e4b4184130f7a42204b6a. --- app/models/question/selection.rb | 15 ------------ spec/models/question/selection_spec.rb | 32 -------------------------- 2 files changed, 47 deletions(-) diff --git a/app/models/question/selection.rb b/app/models/question/selection.rb index a67f6ae89..df2eebf51 100644 --- a/app/models/question/selection.rb +++ b/app/models/question/selection.rb @@ -104,21 +104,6 @@ def none_of_the_above_question_text "#{none_of_the_above_question.question_text} #{I18n.t('page.optional')}" end - def selection=(value) - # TODO: This setter can be removed after 15/06/2026 - if allow_multiple_answers? - if value.include?(I18n.t("page.none_of_the_above", locale: :en)) || value.include?(I18n.t("page.none_of_the_above", locale: :cy)) - super([NONE_OF_THE_ABOVE_VALUE]) - return - end - elsif value == I18n.t("page.none_of_the_above", locale: :en) || value == I18n.t("page.none_of_the_above", locale: :cy) - super(NONE_OF_THE_ABOVE_VALUE) - return - end - - super(value) - end - private def clear_none_of_the_above_answer_if_not_selected diff --git a/spec/models/question/selection_spec.rb b/spec/models/question/selection_spec.rb index 2a9eab273..664098c66 100644 --- a/spec/models/question/selection_spec.rb +++ b/spec/models/question/selection_spec.rb @@ -761,36 +761,4 @@ end end end - - describe "backwards compatibility for none of the above option" do - let(:is_optional) { true } - - context "when the selection question is a checkbox" do - let(:only_one_option) { "false" } - - it "sets the selection to ['none_of_the_above'] when attempting to set to the English localised translation" do - question.selection = [I18n.t("page.none_of_the_above")] - expect(question.selection).to eq([Question::Selection::NONE_OF_THE_ABOVE_VALUE]) - end - - it "sets the selection to ['none_of_the_above'] when attempting to set to the Welsh localised translation" do - question.selection = [I18n.t("page.none_of_the_above", locale: :cy)] - expect(question.selection).to eq([Question::Selection::NONE_OF_THE_ABOVE_VALUE]) - end - end - - context "when the selection question is a radio button" do - let(:only_one_option) { "true" } - - it "sets the selection to 'none_of_the_above' when attempting to set to the English localised translation" do - question.selection = I18n.t("page.none_of_the_above") - expect(question.selection).to eq(Question::Selection::NONE_OF_THE_ABOVE_VALUE) - end - - it "sets the selection to 'none_of_the_above' when attempting to set to the Welsh localised translation" do - question.selection = I18n.t("page.none_of_the_above", locale: :cy) - expect(question.selection).to eq(Question::Selection::NONE_OF_THE_ABOVE_VALUE) - end - end - end end