33describe "Parental consent" do
44 around { |example | travel_to ( Date . new ( 2025 , 8 , 1 ) ) { example . run } }
55
6- scenario "Move to a completed session" do
7- stub_pds_search_to_return_no_patients
6+ before { stub_pds_search_to_return_no_patients }
87
8+ scenario "Move to an unscheduled session" do
99 given_an_hpv_programme_is_underway
1010
1111 when_i_go_to_the_consent_form
1212 and_i_fill_in_my_childs_name_and_birthday
13- and_i_try_to_give_consent
13+ and_i_try_to_give_consent_for_the_unscheduled_school
14+ then_i_see_that_consent_is_open
15+ end
16+
17+ scenario "Move to a completed session" do
18+ given_an_hpv_programme_is_underway
19+
20+ when_i_go_to_the_consent_form
21+ and_i_fill_in_my_childs_name_and_birthday
22+ and_i_try_to_give_consent_for_the_completed_school
1423 then_i_see_that_consent_is_closed
1524 end
1625
@@ -20,10 +29,12 @@ def given_an_hpv_programme_is_underway
2029
2130 @subteam = create ( :subteam , team : @team )
2231
23- @scheduled_school =
32+ @unscheduled_school =
2433 create ( :school , :secondary , name : "School 1" , subteam : @subteam )
25- @completed_school =
34+ @scheduled_school =
2635 create ( :school , :secondary , name : "School 2" , subteam : @subteam )
36+ @completed_school =
37+ create ( :school , :secondary , name : "School 3" , subteam : @subteam )
2738
2839 @scheduled_session =
2940 create (
@@ -34,6 +45,15 @@ def given_an_hpv_programme_is_underway
3445 location : @scheduled_school
3546 )
3647
48+ @unscheduled_session =
49+ create (
50+ :session ,
51+ :unscheduled ,
52+ team : @team ,
53+ programmes : [ @programme ] ,
54+ location : @unscheduled_school
55+ )
56+
3757 @completed_session =
3858 create (
3959 :session ,
@@ -69,14 +89,27 @@ def and_i_fill_in_my_childs_name_and_birthday
6989 click_on "Continue"
7090 end
7191
72- def and_i_try_to_give_consent
92+ def and_i_try_to_give_consent_for_the_unscheduled_school
93+ choose "No, they go to a different school"
94+ click_on "Continue"
95+
96+ select @unscheduled_school . name
97+ click_on "Continue"
98+ end
99+
100+ def and_i_try_to_give_consent_for_the_completed_school
73101 choose "No, they go to a different school"
74102 click_on "Continue"
75103
76104 select @completed_school . name
77105 click_on "Continue"
78106 end
79107
108+ def then_i_see_that_consent_is_open
109+ expect ( page ) . to have_content ( "About you" )
110+ expect ( page ) . to have_button ( "Continue" )
111+ end
112+
80113 def then_i_see_that_consent_is_closed
81114 expect ( page ) . to have_content ( "The deadline for responding has passed" )
82115 expect ( page ) . to have_content (
0 commit comments