|
105 | 105 | end |
106 | 106 | end |
107 | 107 |
|
| 108 | + describe "with multiple pages of new records" do |
| 109 | + let(:new_records) do |
| 110 | + create_list(:patient_changeset, 75, :new_patient, import:) |
| 111 | + end |
| 112 | + let(:new_records_pagy) do |
| 113 | + instance_double( |
| 114 | + Pagy, |
| 115 | + count: new_records.count, |
| 116 | + limit: 50, |
| 117 | + from: 1, |
| 118 | + to: 50 |
| 119 | + ).as_null_object |
| 120 | + end |
| 121 | + |
| 122 | + include_examples "section with details", |
| 123 | + title: "New records", |
| 124 | + summary: /75 new records\s+\(showing 1 to 50\)/, |
| 125 | + count: 75 |
| 126 | + |
| 127 | + it "shows the section description" do |
| 128 | + expect(rendered).to have_content( |
| 129 | + "This upload includes 75 new records that are not currently in Mavis" |
| 130 | + ) |
| 131 | + expect(rendered).to have_content( |
| 132 | + "If you approve the upload, these records will be added to Mavis" |
| 133 | + ) |
| 134 | + end |
| 135 | + end |
| 136 | + |
108 | 137 | describe "with auto-matched records" do |
109 | 138 | let(:auto_matched_records) do |
110 | 139 | [ |
|
263 | 292 | end |
264 | 293 | end |
265 | 294 |
|
| 295 | + describe "with multiple pages of school moves" do |
| 296 | + let(:school_moves) do |
| 297 | + create_list( |
| 298 | + :patient_changeset, |
| 299 | + 55, |
| 300 | + :with_school_move, |
| 301 | + import:, |
| 302 | + patient: school_move_patient, |
| 303 | + school: second_location |
| 304 | + ) |
| 305 | + end |
| 306 | + let(:school_moves_pagy) do |
| 307 | + instance_double( |
| 308 | + Pagy, |
| 309 | + count: school_moves.count, |
| 310 | + limit: 50, |
| 311 | + from: 1, |
| 312 | + to: 50 |
| 313 | + ).as_null_object |
| 314 | + end |
| 315 | + |
| 316 | + include_examples "section with details", |
| 317 | + title: "School moves - resolve after import", |
| 318 | + summary: /55 school moves\s+\(showing 1 to 50\)/, |
| 319 | + count: 55 |
| 320 | + |
| 321 | + it "shows correct total in import message" do |
| 322 | + expect(rendered).to have_content( |
| 323 | + "This upload includes 55 children with a different school to the one on their Mavis record" |
| 324 | + ) |
| 325 | + end |
| 326 | + end |
| 327 | + |
266 | 328 | describe "with skipped school moves" do |
267 | 329 | let(:other_team_school) do |
268 | 330 | create(:school, team: other_team, name: "School in Other Team") |
|
0 commit comments