Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .review_apps/ecs_task_definition.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ locals {
{ name = "SETTINGS__AUTH_PROVIDER", value = "developer" },
{ name = "SETTINGS__FORMS_ENV", value = "review" },
{ name = "SETTINGS__FORMS_RUNNER__URL", value = "https://forms.service.gov.uk" },
{ name = "SETTINGS__FEATURES__DESCRIBE_NONE_OF_THE_ABOVE_ENABLED", value = "true" }
]
}

Expand Down
6 changes: 1 addition & 5 deletions app/input_objects/pages/selection/base_options_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ def submit
end

def include_none_of_the_above_options
if FeatureService.enabled?(:describe_none_of_the_above_enabled)
[OpenStruct.new(id: "yes"), OpenStruct.new(id: "yes_with_question"), OpenStruct.new(id: "no")]
else
[OpenStruct.new(id: "yes"), OpenStruct.new(id: "no")]
end
[OpenStruct.new(id: "yes"), OpenStruct.new(id: "yes_with_question"), OpenStruct.new(id: "no")]
end

def include_none_of_the_above_with_question?
Expand Down
1 change: 0 additions & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ features:
enabled_by_group: true
welsh:
enabled_by_group: true
describe_none_of_the_above_enabled: false

forms_api:
# Authentication key to authenticate with forms-api
Expand Down
1 change: 0 additions & 1 deletion spec/config/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
features = settings[:features]

include_examples expected_value_test, :welsh, features, { "enabled_by_group" => true }
include_examples expected_value_test, :describe_none_of_the_above_enabled, features, false
end

describe "forms_api" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
create(:membership, group:, user: standard_user, added_by: standard_user)

login_as standard_user

allow(FeatureService).to receive(:enabled?).with(:describe_none_of_the_above_enabled).and_return(true)
end

context "when a form has no existing pages" do
Expand Down
21 changes: 2 additions & 19 deletions spec/support/shared_examples/pages_selection_base_options_input.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
RSpec.shared_examples "base selection options input" do
describe "#include_none_of_the_above_options" do
let(:describe_none_of_the_above_enabled) { true }

before do
allow(FeatureService).to receive(:enabled?).with(:describe_none_of_the_above_enabled)
.and_return(describe_none_of_the_above_enabled)
end

context "when the describe_none_of_the_above_enabled feature is enabled" do
it "includes an option for yes_with_question" do
expect(input.include_none_of_the_above_options).to contain_exactly(OpenStruct.new(id: "yes"), OpenStruct.new(id: "yes_with_question"), OpenStruct.new(id: "no"))
end
end

context "when the describe_none_of_the_above_enabled feature is disabled" do
let(:describe_none_of_the_above_enabled) { false }

it "does not include an option for yes_with_question" do
expect(input.include_none_of_the_above_options).to contain_exactly(OpenStruct.new(id: "yes"), OpenStruct.new(id: "no"))
end
it "has the expected radio options" do
expect(input.include_none_of_the_above_options).to contain_exactly(OpenStruct.new(id: "yes"), OpenStruct.new(id: "yes_with_question"), OpenStruct.new(id: "no"))
end
end

Expand Down
77 changes: 32 additions & 45 deletions spec/views/pages/selection/bulk_options.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
let(:selection_options) { [] }
let(:page_number) { 1 }
let(:back_link_url) { "/a-back-link-url" }
let(:describe_none_of_the_above_enabled) { true }

before do
form.reload
Expand All @@ -23,8 +22,6 @@
allow(view).to receive_messages(form_pages_path: "/type-of-answer", current_form: form)
end

allow(FeatureService).to receive(:enabled?).with(:describe_none_of_the_above_enabled).and_return(describe_none_of_the_above_enabled)

# # setup instance variables
@bulk_options_input = bulk_options_input
@bulk_options_path = selection_bulk_options_create_path(form.id)
Expand Down Expand Up @@ -97,60 +94,50 @@
end

describe "include none of the above radios" do
context "when the describe_none_of_the_above_enabled feature is enabled" do
it "contains a radio question for choosing whether to make the form live" do
expect(rendered).to have_css("fieldset", text: I18n.t("helpers.legend.pages_selection_bulk_options_input.include_none_of_the_above"))
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes"), type: "radio")
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes_with_question"), type: "radio")
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.no"), type: "radio")
end

context "when input object has value of yes'" do
let(:include_none_of_the_above) { "yes" }

it "has 'Yes' radio selected" do
expect(rendered).to have_checked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes_with_question")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "no")
end
end
it "contains a radio question for choosing whether to include an option for none of the above" do
expect(rendered).to have_css("fieldset", text: I18n.t("helpers.legend.pages_selection_bulk_options_input.include_none_of_the_above"))
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes"), type: "radio")
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes_with_question"), type: "radio")
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.no"), type: "radio")
end

context "when input object has value of yes_with_question" do
let(:include_none_of_the_above) { "yes_with_question" }
context "when input object has value of yes'" do
let(:include_none_of_the_above) { "yes" }

it "has 'No' radio selected" do
expect(rendered).to have_checked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes_with_question")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "no")
end
it "has 'Yes' radio selected" do
expect(rendered).to have_checked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes_with_question")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "no")
end
end

context "when input object has value of no" do
let(:include_none_of_the_above) { "no" }
context "when input object has value of yes_with_question" do
let(:include_none_of_the_above) { "yes_with_question" }

it "has 'No' radio selected" do
expect(rendered).to have_checked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "no")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes_with_question")
end
it "has 'No' radio selected" do
expect(rendered).to have_checked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes_with_question")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "no")
end
end

context "when input object has no value set" do
let(:include_none_of_the_above) { nil }
context "when input object has value of no" do
let(:include_none_of_the_above) { "no" }

it "does not have a radio option selected" do
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "no")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes_with_question")
end
it "has 'No' radio selected" do
expect(rendered).to have_checked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "no")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes_with_question")
end
end

context "when the describe_none_of_the_above_enabled feature is disabled" do
let(:describe_none_of_the_above_enabled) { false }
context "when input object has no value set" do
let(:include_none_of_the_above) { nil }

it "does not render the yes_with_question radio option" do
expect(rendered).not_to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes_with_question"))
it "does not have a radio option selected" do
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "no")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_bulk_options_input[include_none_of_the_above]", with: "yes_with_question")
end
end
end
Expand Down
77 changes: 32 additions & 45 deletions spec/views/pages/selection/options.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
let(:include_none_of_the_above) { "yes" }
let(:only_one_option) { "true" }
let(:draft_question) { build :draft_question, answer_type: "selection", answer_settings: { only_one_option: } }
let(:describe_none_of_the_above_enabled) { true }

before do
# # mock the form.page_number method
Expand All @@ -22,8 +21,6 @@
allow(view).to receive_messages(form_pages_path: "/pages", current_form: form)
end

allow(FeatureService).to receive(:enabled?).with(:describe_none_of_the_above_enabled).and_return(describe_none_of_the_above_enabled)

# # setup instance variables
assign(:page, page)
assign(:selection_options_path, selection_options_path)
Expand Down Expand Up @@ -126,60 +123,50 @@
end

describe "include none of the above radios" do
context "when the describe_none_of_the_above_enabled feature is enabled" do
it "contains a radio question for choosing whether to make the form live" do
expect(rendered).to have_css("fieldset", text: I18n.t("helpers.legend.pages_selection_bulk_options_input.include_none_of_the_above"))
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes"), type: "radio")
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes_with_question"), type: "radio")
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.no"), type: "radio")
end

context "when input object has value of yes'" do
let(:include_none_of_the_above) { "yes" }

it "has 'Yes' radio selected" do
expect(rendered).to have_checked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes_with_question")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "no")
end
end
it "contains a radio question for choosing whether to include an option for none of the above" do
expect(rendered).to have_css("fieldset", text: I18n.t("helpers.legend.pages_selection_bulk_options_input.include_none_of_the_above"))
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes"), type: "radio")
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes_with_question"), type: "radio")
expect(rendered).to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.no"), type: "radio")
end

context "when input object has value of yes_with_question" do
let(:include_none_of_the_above) { "yes_with_question" }
context "when input object has value of yes'" do
let(:include_none_of_the_above) { "yes" }

it "has 'No' radio selected" do
expect(rendered).to have_checked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes_with_question")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "no")
end
it "has 'Yes' radio selected" do
expect(rendered).to have_checked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes_with_question")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "no")
end
end

context "when input object has value of no" do
let(:include_none_of_the_above) { "no" }
context "when input object has value of yes_with_question" do
let(:include_none_of_the_above) { "yes_with_question" }

it "has 'No' radio selected" do
expect(rendered).to have_checked_field("pages_selection_options_input[include_none_of_the_above]", with: "no")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes_with_question")
end
it "has 'No' radio selected" do
expect(rendered).to have_checked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes_with_question")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "no")
end
end

context "when input object has no value set" do
let(:include_none_of_the_above) { nil }
context "when input object has value of no" do
let(:include_none_of_the_above) { "no" }

it "does not have a radio option selected" do
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "no")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes_with_question")
end
it "has 'No' radio selected" do
expect(rendered).to have_checked_field("pages_selection_options_input[include_none_of_the_above]", with: "no")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes_with_question")
end
end

context "when the describe_none_of_the_above_enabled feature is disabled" do
let(:describe_none_of_the_above_enabled) { false }
context "when input object has no value set" do
let(:include_none_of_the_above) { nil }

it "does not render the yes_with_question radio option" do
expect(rendered).not_to have_field(I18n.t("helpers.label.pages_selection_bulk_options_input.include_none_of_the_above_options.yes_with_question"))
it "does not have a radio option selected" do
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "no")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes")
expect(rendered).to have_unchecked_field("pages_selection_options_input[include_none_of_the_above]", with: "yes_with_question")
end
end
end
Expand Down