|
50 | 50 |
|
51 | 51 | when_i_confirm_the_school |
52 | 52 | and_i_continue |
| 53 | + then_i_see_the_phase_screen |
| 54 | + |
| 55 | + when_i_select_a_phase |
| 56 | + and_i_continue |
53 | 57 | then_i_see_the_year_groups_screen |
54 | 58 | and_year_groups_are_pre_selected |
55 | 59 |
|
|
80 | 84 |
|
81 | 85 | when_i_fill_in_the_school_site_details |
82 | 86 | and_i_continue |
| 87 | + then_i_see_the_phase_screen |
| 88 | + |
| 89 | + when_i_select_a_phase |
| 90 | + and_i_continue |
83 | 91 | then_i_see_the_year_groups_screen |
84 | 92 | and_year_groups_are_pre_selected |
85 | 93 |
|
|
136 | 144 | and_the_site_details_are_updated |
137 | 145 | end |
138 | 146 |
|
| 147 | + scenario "Editing a school phase" do |
| 148 | + given_my_team_exists |
| 149 | + |
| 150 | + when_i_click_on_team_settings |
| 151 | + when_i_click_on_schools |
| 152 | + |
| 153 | + when_i_click_on_edit_a_school |
| 154 | + then_i_see_the_school_summary_with_phase_and_year_groups_links |
| 155 | + |
| 156 | + when_i_click_on_change_phase |
| 157 | + and_i_select_a_new_phase |
| 158 | + and_i_continue |
| 159 | + then_i_see_the_phase_is_updated |
| 160 | + |
| 161 | + when_i_click_save_changes |
| 162 | + then_i_see_the_team_schools |
| 163 | + and_the_school_phase_is_updated |
| 164 | + end |
| 165 | + |
139 | 166 | scenario "Editing a school" do |
140 | 167 | given_my_team_exists |
141 | 168 |
|
|
144 | 171 | then_i_see_the_team_schools |
145 | 172 |
|
146 | 173 | when_i_click_on_edit_a_school |
147 | | - then_i_see_the_school_summary_with_only_year_groups_link |
| 174 | + then_i_see_the_school_summary_with_phase_and_year_groups_links |
148 | 175 |
|
149 | 176 | when_i_click_on_change_year_groups |
150 | 177 | when_i_try_to_remove_a_year_group |
@@ -241,11 +268,13 @@ def then_i_see_the_school_summary_with_edit_links |
241 | 268 | expect(page).to have_content("Site B") |
242 | 269 | expect(page).to have_link("Change", text: /name/i) |
243 | 270 | expect(page).to have_link("Change", text: /address/i) |
| 271 | + expect(page).to have_link("Change", text: /phase/i) |
244 | 272 | expect(page).to have_link("Change", text: /year groups/i) |
245 | 273 | end |
246 | 274 |
|
247 | | - def then_i_see_the_school_summary_with_only_year_groups_link |
| 275 | + def then_i_see_the_school_summary_with_phase_and_year_groups_links |
248 | 276 | expect(page).to have_content(@school.name) |
| 277 | + expect(page).to have_link("Change", text: /phase/i) |
249 | 278 | expect(page).to have_link("Change", text: /year groups/i) |
250 | 279 | expect(page).not_to have_link("Change", text: /name/i) |
251 | 280 | expect(page).not_to have_link("Change", text: /address/i) |
@@ -529,4 +558,31 @@ def and_the_school_has_the_correct_year_groups |
529 | 558 | @available_school.reload |
530 | 559 | expect(@available_school.location_year_groups.pluck(:value)).to include(12) |
531 | 560 | end |
| 561 | + |
| 562 | + def then_i_see_the_phase_screen |
| 563 | + expect(page).to have_content("Phase") |
| 564 | + expect(page).to have_field("Primary", type: :radio) |
| 565 | + expect(page).to have_field("Secondary", type: :radio) |
| 566 | + end |
| 567 | + |
| 568 | + def when_i_select_a_phase |
| 569 | + choose "Secondary" |
| 570 | + end |
| 571 | + |
| 572 | + def when_i_click_on_change_phase |
| 573 | + click_on "Change phase" |
| 574 | + end |
| 575 | + |
| 576 | + def and_i_select_a_new_phase |
| 577 | + choose "Primary" |
| 578 | + end |
| 579 | + |
| 580 | + def then_i_see_the_phase_is_updated |
| 581 | + expect(page).to have_content("Primary") |
| 582 | + end |
| 583 | + |
| 584 | + def and_the_school_phase_is_updated |
| 585 | + @school.reload |
| 586 | + expect(@school.phase).to eq("primary") |
| 587 | + end |
532 | 588 | end |
0 commit comments