|
107 | 107 | end
|
108 | 108 |
|
109 | 109 | def given_there_is_an_application_form
|
110 |
| - application_form |
| 110 | + assessment = |
| 111 | + create(:assessment, :with_further_information_request, application_form:) |
| 112 | + assessment_section = |
| 113 | + create(:assessment_section, :personal_information, assessment:) |
| 114 | + assessment.further_information_requests.first.items.each do |item| |
| 115 | + create( |
| 116 | + :selected_failure_reason, |
| 117 | + assessment_section: assessment_section, |
| 118 | + key: item.failure_reason_key, |
| 119 | + ) |
| 120 | + end |
111 | 121 | end
|
112 | 122 |
|
113 | 123 | def when_i_click_the_start_button
|
@@ -151,22 +161,22 @@ def when_i_click_the_text_task_list_item
|
151 | 161 | expect(
|
152 | 162 | teacher_further_information_required_page.failure_reason_heading.text,
|
153 | 163 | ).to eq(
|
154 |
| - "The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them.", |
| 164 | + "The subjects you entered are acceptable for QTS, but the uploaded qualifications do not match them", |
155 | 165 | )
|
156 | 166 | end
|
157 | 167 |
|
158 | 168 | def when_i_click_the_work_history_contact_task_list_item
|
159 | 169 | work_history_task_list_item.click
|
160 | 170 | expect(
|
161 | 171 | teacher_further_information_required_page.failure_reason_heading.text,
|
162 |
| - ).to eq("We could not verify 1 or more references you provided.") |
| 172 | + ).to eq("We could not verify 1 or more references you provided") |
163 | 173 | end
|
164 | 174 |
|
165 | 175 | def when_i_click_the_document_task_list_item
|
166 | 176 | document_task_list_item.click
|
167 | 177 | expect(
|
168 | 178 | teacher_further_information_required_page.failure_reason_heading.text,
|
169 |
| - ).to eq("Your ID document is illegible or in a format we cannot accept.") |
| 179 | + ).to eq("Your ID document is illegible or in a format we cannot accept") |
170 | 180 | end
|
171 | 181 |
|
172 | 182 | def when_i_fill_in_the_response
|
@@ -208,25 +218,21 @@ def when_i_click_the_check_your_answers_task_list_item
|
208 | 218 | end
|
209 | 219 |
|
210 | 220 | def check_your_answers_task_list_item
|
211 |
| - teacher_further_information_requested_page.task_list.find_item( |
| 221 | + teacher_further_information_requested_page.task_lists.last.find_item( |
212 | 222 | "Check your answers before submitting",
|
213 | 223 | )
|
214 | 224 | end
|
215 | 225 |
|
216 | 226 | def and_i_see_the_check_your_answers_items
|
217 |
| - rows = |
218 |
| - teacher_check_further_information_request_answers_page.summary_list.rows |
| 227 | + lists = teacher_check_further_information_request_answers_page.summary_lists |
219 | 228 |
|
220 |
| - expect(rows.count).to eq(3) |
| 229 | + expect(lists.count).to eq(3) |
221 | 230 |
|
222 |
| - expect(rows.first.key.text).to eq( |
223 |
| - "Tell us more about the subjects you can teach", |
224 |
| - ) |
225 |
| - expect(rows.second.key.text).to eq( |
226 |
| - "Update reference details for #{application_form.work_histories.first.school_name}", |
227 |
| - ) |
228 |
| - |
229 |
| - expect(rows.last.key.text).to eq("Upload your identity document") |
| 231 | + expect( |
| 232 | + teacher_check_further_information_request_answers_page, |
| 233 | + ).to have_content("Your response").and have_content( |
| 234 | + "Reference details", |
| 235 | + ).and have_content("Identity documents") |
230 | 236 | end
|
231 | 237 |
|
232 | 238 | def when_i_click_the_text_check_your_answers_item
|
@@ -274,58 +280,51 @@ def teacher
|
274 | 280 |
|
275 | 281 | def application_form
|
276 | 282 | @application_form ||=
|
277 |
| - begin |
278 |
| - application_form = |
279 |
| - create( |
280 |
| - :application_form, |
281 |
| - :submitted, |
282 |
| - :with_work_history, |
283 |
| - statuses: %w[waiting_on_further_information], |
284 |
| - teacher:, |
285 |
| - ) |
286 |
| - create( |
287 |
| - :assessment, |
288 |
| - :with_further_information_request, |
289 |
| - application_form:, |
290 |
| - ) |
291 |
| - application_form |
292 |
| - end |
| 283 | + create( |
| 284 | + :application_form, |
| 285 | + :submitted, |
| 286 | + :with_work_history, |
| 287 | + statuses: %w[waiting_on_further_information], |
| 288 | + teacher:, |
| 289 | + ) |
293 | 290 | end
|
294 | 291 |
|
295 | 292 | def further_information_request
|
296 |
| - application_form.assessment.further_information_requests.first |
| 293 | + application_form.reload.assessment.further_information_requests.first |
297 | 294 | end
|
298 | 295 |
|
299 | 296 | def text_task_list_item
|
300 |
| - teacher_further_information_requested_page.task_list.find_item( |
| 297 | + teacher_further_information_requested_page.task_lists.first.find_item( |
301 | 298 | "Tell us more about the subjects you can teach",
|
302 | 299 | )
|
303 | 300 | end
|
304 | 301 |
|
305 | 302 | def text_check_answers_item
|
306 | 303 | teacher_check_further_information_request_answers_page
|
307 |
| - .summary_list |
| 304 | + .summary_lists |
| 305 | + .second |
308 | 306 | .rows
|
309 | 307 | .first
|
310 | 308 | end
|
311 | 309 |
|
312 | 310 | def work_history_task_list_item
|
313 |
| - teacher_further_information_requested_page.task_list.find_item( |
| 311 | + teacher_further_information_requested_page.task_lists.first.find_item( |
314 | 312 | "Update reference details for #{application_form.work_histories.first.school_name}",
|
315 | 313 | )
|
316 | 314 | end
|
317 | 315 |
|
318 | 316 | def document_task_list_item
|
319 |
| - teacher_further_information_requested_page.task_list.find_item( |
| 317 | + teacher_further_information_requested_page.task_lists.first.find_item( |
320 | 318 | "Upload your identity document",
|
321 | 319 | )
|
322 | 320 | end
|
323 | 321 |
|
324 | 322 | def document_check_answers_item
|
325 | 323 | teacher_check_further_information_request_answers_page
|
326 |
| - .summary_list |
| 324 | + .summary_lists |
| 325 | + .first |
327 | 326 | .rows
|
328 |
| - .last |
| 327 | + .first |
329 | 328 | end
|
330 | 329 |
|
331 | 330 | def then_i_see_the_warning_text
|
|
0 commit comments