9
9
given_an_hpv_programme_is_underway
10
10
11
11
when_i_go_to_the_consent_form
12
- when_i_fill_in_my_childs_name_and_birthday
13
-
14
- when_i_give_consent
15
- and_i_answer_no_to_all_the_medical_questions
16
- then_i_can_check_my_answers
17
-
18
- when_i_submit_the_consent_form
19
- then_i_get_a_confirmation_email
12
+ and_i_fill_in_my_childs_name_and_birthday
13
+ and_i_try_to_give_consent
14
+ then_i_see_that_consent_is_closed
20
15
end
21
16
22
17
def given_an_hpv_programme_is_underway
23
18
@programme = create ( :programme , :hpv )
24
19
@team = create ( :team , :with_one_nurse , programmes : [ @programme ] )
25
20
26
- subteam = create ( :subteam , team : @team )
21
+ @ subteam = create ( :subteam , team : @team )
27
22
28
- @scheduled_school = create ( :school , :secondary , name : "School 1" , subteam :)
29
- @completed_school = create ( :school , :secondary , name : "School 2" , subteam :)
23
+ @scheduled_school =
24
+ create ( :school , :secondary , name : "School 1" , subteam : @subteam )
25
+ @completed_school =
26
+ create ( :school , :secondary , name : "School 2" , subteam : @subteam )
30
27
31
28
@scheduled_session =
32
29
create (
@@ -46,29 +43,7 @@ def given_an_hpv_programme_is_underway
46
43
location : @completed_school
47
44
)
48
45
49
- @child = create ( :patient , session : @scheduled_session )
50
- end
51
-
52
- def when_a_nurse_checks_consent_responses
53
- sign_in @team . users . first
54
- visit "/dashboard"
55
-
56
- click_on "Programmes" , match : :first
57
- click_on "HPV"
58
- within ".app-secondary-navigation" do
59
- click_on "Sessions"
60
- end
61
- click_on "Pilot School"
62
- click_on "Consent"
63
- end
64
-
65
- def then_there_should_be_no_consent_for_my_child
66
- expect ( page ) . to have_content ( "No response" )
67
-
68
- check "No response"
69
- click_on "Update results"
70
-
71
- expect ( page ) . to have_content ( @child . full_name )
46
+ @patient = create ( :patient , session : @scheduled_session )
72
47
end
73
48
74
49
def when_i_go_to_the_consent_form
@@ -78,76 +53,34 @@ def when_i_go_to_the_consent_form
78
53
)
79
54
end
80
55
81
- def when_i_give_consent
82
- choose "No, they go to a different school"
83
- click_on "Continue"
84
-
85
- select @completed_school . name
86
- click_on "Continue"
87
-
88
- expect ( page ) . to have_content ( "About you" )
89
- fill_in "Full name" , with : "Jane #{ @child . family_name } "
90
- choose "Mum" # Your relationship to the child
91
- fill_in "Email address" , with : "jane@example.com"
92
- fill_in "Phone number" , with : "07123456789"
93
- check "Tick this box if you’d like to get updates by text message"
94
- click_on "Continue"
95
-
96
- expect ( page ) . to have_content ( "Phone contact method" )
97
- choose "I do not have specific needs"
98
- click_on "Continue"
99
-
100
- expect ( page ) . to have_content ( "Do you agree" )
101
- choose "Yes, I agree"
102
- click_on "Continue"
103
-
104
- expect ( page ) . to have_content ( "Home address" )
105
- fill_in "Address line 1" , with : "1 Test Street"
106
- fill_in "Address line 2 (optional)" , with : "2nd Floor"
107
- fill_in "Town or city" , with : "Testville"
108
- fill_in "Postcode" , with : "TE1 1ST"
109
- click_on "Continue"
110
- end
111
-
112
- def when_i_fill_in_my_childs_name_and_birthday
56
+ def and_i_fill_in_my_childs_name_and_birthday
113
57
click_on "Start now"
114
58
115
59
expect ( page ) . to have_content ( "What is your child’s name?" )
116
- fill_in "First name" , with : @child . given_name
117
- fill_in "Last name" , with : @child . family_name
60
+ fill_in "First name" , with : @patient . given_name
61
+ fill_in "Last name" , with : @patient . family_name
118
62
choose "No" # Do they use a different name in school?
119
63
click_on "Continue"
120
64
121
65
expect ( page ) . to have_content ( "What is your child’s date of birth?" )
122
- fill_in "Day" , with : @child . date_of_birth . day
123
- fill_in "Month" , with : @child . date_of_birth . month
124
- fill_in "Year" , with : @child . date_of_birth . year
66
+ fill_in "Day" , with : @patient . date_of_birth . day
67
+ fill_in "Month" , with : @patient . date_of_birth . month
68
+ fill_in "Year" , with : @patient . date_of_birth . year
125
69
click_on "Continue"
126
70
end
127
71
128
- def and_i_answer_no_to_all_the_medical_questions
129
- until page . has_content? ( "Check and confirm" )
130
- choose "No"
131
- click_on "Continue"
132
- end
133
- end
134
-
135
- def then_i_can_check_my_answers
136
- expect ( page ) . to have_content ( "Check and confirm" )
137
- expect ( page ) . to have_content (
138
- "Child’s name#{ @child . full_name ( context : :parents ) } "
139
- )
140
- end
72
+ def and_i_try_to_give_consent
73
+ choose "No, they go to a different school"
74
+ click_on "Continue"
141
75
142
- def when_i_submit_the_consent_form
143
- click_on "Confirm "
76
+ select @completed_school . name
77
+ click_on "Continue "
144
78
end
145
79
146
- def then_i_get_a_confirmation_email
80
+ def then_i_see_that_consent_is_closed
81
+ expect ( page ) . to have_content ( "The deadline for responding has passed" )
147
82
expect ( page ) . to have_content (
148
- "#{ @child . full_name ( context : :parents ) } is due to get the HPV vaccination at school "
83
+ "Contact #{ @subteam . email } to book a clinic appointment. "
149
84
)
150
-
151
- expect_email_to ( "jane@example.com" , :consent_confirmation_clinic )
152
85
end
153
86
end
0 commit comments