Skip to content

Commit 9aa50e4

Browse files
authored
Merge pull request #5999 from nhsuk/feature-flag-ethnicity-questions
Add feature flag for ethnicity capture
2 parents a355058 + b0e1697 commit 9aa50e4

13 files changed

Lines changed: 38 additions & 7 deletions

app/controllers/parent_interface/consent_forms_controller.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ def record
6767
# onto the matched patient.
6868
ProcessConsentFormJob.perform_later(@consent_form.id)
6969

70-
redirect_to parent_interface_consent_form_edit_path(
71-
@consent_form,
72-
"ethnicity"
73-
)
70+
if Flipper.enabled?(:ethnicity_capture)
71+
redirect_to parent_interface_consent_form_edit_path(
72+
@consent_form,
73+
"ethnicity"
74+
)
75+
else
76+
redirect_to submitted_parent_interface_consent_form_path(@consent_form)
77+
end
7478
end
7579

7680
def submitted

app/models/consent_form.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ def wizard_steps
362362
:reason_for_refusal_notes
363363
end
364364
)
365-
].compact + (recorded? ? ETHNICITY_STEPS : [])
365+
].compact +
366+
(Flipper.enabled?(:ethnicity_capture) && recorded? ? ETHNICITY_STEPS : [])
366367
end
367368

368369
def recorded? = recorded_at != nil

config/feature_flags.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ basic_auth: Require users to sign in with basic authentication before they
33

44
dev_tools: Developer tools useful for testing and debugging.
55

6+
ethnicity_capture: Enable optional ethnicity capture after parent consent
7+
68
imms_api_enqueue_rolling_searches: |
79
Enables enqueueing of vaccination searches for patients not in sessions,
810
spread over a period of 28 days, in the EnqueueVaccinationsSearchInNHSJob.

spec/features/parental_consent_change_answers_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ def and_i_choose_my_phone_contact_method
300300
end
301301

302302
def and_i_refuse_to_answer_questions_on_ethnicity
303+
return unless Flipper.enabled?(:ethnicity_capture)
304+
303305
choose "No, skip the ethnicity questions"
304306
click_on "Continue"
305307
end

spec/features/parental_consent_clinic_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ def then_the_nurse_should_see_unknown_school
301301
end
302302

303303
def and_i_refuse_to_answer_questions_on_ethnicity
304+
return unless Flipper.enabled?(:ethnicity_capture)
305+
304306
choose "No, skip the ethnicity questions"
305307
click_on "Continue"
306308
end

spec/features/parental_consent_create_patient_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def then_the_patient_should_be_safe_to_vaccinate
213213
end
214214

215215
def and_i_refuse_to_answer_questions_on_ethnicity
216+
return unless Flipper.enabled?(:ethnicity_capture)
217+
216218
choose "No, skip the ethnicity questions"
217219
click_on "Continue"
218220
end

spec/features/parental_consent_different_school_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ def then_i_see_the_confirmation_page
140140
end
141141

142142
def and_i_refuse_to_answer_questions_on_ethnicity
143+
return unless Flipper.enabled?(:ethnicity_capture)
144+
143145
choose "No, skip the ethnicity questions"
144146
click_on "Continue"
145147
end

spec/features/parental_consent_flu_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# frozen_string_literal: true
22

33
describe "Parental consent" do
4+
before { given_ethnicity_capture_is_enabled }
5+
46
scenario "Flu" do
57
given_a_flu_programme_is_underway
68
when_i_go_to_the_consent_form
@@ -82,6 +84,10 @@
8284
then_the_psd_is_invalidated
8385
end
8486

87+
def given_ethnicity_capture_is_enabled
88+
Flipper.enable(:ethnicity_capture)
89+
end
90+
8591
def given_a_flu_programme_is_underway
8692
@programme = Programme.flu
8793
@team = create(:team, :with_one_nurse, programmes: [@programme])

spec/features/parental_consent_hpv_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ def then_the_patient_should_be_safe_to_vaccinate
214214
end
215215

216216
def and_i_refuse_to_answer_questions_on_ethnicity
217+
return unless Flipper.enabled?(:ethnicity_capture)
218+
217219
choose "No, skip the ethnicity questions"
218220
click_on "Continue"
219221
end

spec/features/parental_consent_inexact_auto_match_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ def when_a_parent_gives_consent_with_three_of_four_fields_matching_the_cohort
8787
expect(page).to have_content("Child’s nameJoanna Smith")
8888
click_on "Confirm"
8989

90-
choose "No, skip the ethnicity questions"
91-
click_on "Continue"
90+
if Flipper.enabled?(:ethnicity_capture)
91+
choose "No, skip the ethnicity questions"
92+
click_on "Continue"
93+
end
9294

9395
expect(page).to have_content(
9496
"Joanna Smith is due to get the HPV vaccination at school"

0 commit comments

Comments
 (0)