|
25 | 25 | {
|
26 | 26 | "CHILD_ADDRESS_LINE_1" => "10 Downing Street",
|
27 | 27 | "CHILD_ADDRESS_LINE_2" => "",
|
28 |
| - "CHILD_PREFERRED_GIVEN_NAME" => "Jim", |
| 28 | + "CHILD_PREFERRED_FIRST_NAME" => "Jim", |
29 | 29 | "CHILD_DATE_OF_BIRTH" => "2010-01-01",
|
30 | 30 | "CHILD_FIRST_NAME" => "Jimmy",
|
31 | 31 | "CHILD_GENDER" => "Male",
|
|
166 | 166 | )
|
167 | 167 | end
|
168 | 168 | end
|
| 169 | + |
| 170 | + context "when uploading different caps name" do |
| 171 | + let(:capitalised_parent_2_data) do |
| 172 | + { |
| 173 | + "PARENT_2_EMAIL" => "jenny@example.com", |
| 174 | + "PARENT_2_NAME" => "Jenny Smith" |
| 175 | + } |
| 176 | + end |
| 177 | + let(:data) { valid_data.merge(capitalised_parent_2_data) } |
| 178 | + |
| 179 | + let!(:existing_parent) do |
| 180 | + create(:parent, full_name: "JENNY SMITH", email: "jenny@example.com") |
| 181 | + end |
| 182 | + |
| 183 | + it { should eq([existing_parent]) } |
| 184 | + end |
169 | 185 | end
|
170 | 186 |
|
171 | 187 | describe "#to_patient" do
|
|
221 | 237 | expect(patient.pending_changes).to include("registration" => "8AB")
|
222 | 238 | end
|
223 | 239 | end
|
| 240 | + |
| 241 | + context "with an existing patient with different capitalisation" do |
| 242 | + let(:data) do |
| 243 | + { |
| 244 | + "CHILD_ADDRESS_LINE_1" => "10 Downing Street", |
| 245 | + "CHILD_ADDRESS_LINE_2" => "", |
| 246 | + "CHILD_PREFERRED_FIRST_NAME" => "Jim", |
| 247 | + "CHILD_DATE_OF_BIRTH" => "2010-01-01", |
| 248 | + "CHILD_FIRST_NAME" => "Jimmy", |
| 249 | + "CHILD_GENDER" => "Male", |
| 250 | + "CHILD_LAST_NAME" => "Smith", |
| 251 | + "CHILD_PREFERRED_LAST_NAME" => "Smithy", |
| 252 | + "CHILD_NHS_NUMBER" => "1234567890", |
| 253 | + "CHILD_POSTCODE" => "sw1a 1aa", |
| 254 | + "CHILD_SCHOOL_URN" => school_urn, |
| 255 | + "CHILD_TOWN" => "London" |
| 256 | + } |
| 257 | + end |
| 258 | + |
| 259 | + let!(:existing_patient) do |
| 260 | + create( |
| 261 | + :patient, |
| 262 | + address_postcode: "SW1A 1AA", |
| 263 | + family_name: "SMITH", |
| 264 | + gender_code: "male", |
| 265 | + given_name: "JIMMY", |
| 266 | + nhs_number: "1234567890", |
| 267 | + address_line_1: "10 DOWNING STREET", |
| 268 | + preferred_given_name: "JIM", |
| 269 | + preferred_family_name: "SMITHY", |
| 270 | + date_of_birth: Date.new(2010, 1, 1), |
| 271 | + address_town: "LONDON" |
| 272 | + ) |
| 273 | + end |
| 274 | + |
| 275 | + it { should eq(existing_patient) } |
| 276 | + |
| 277 | + it "saves the incoming values" do |
| 278 | + expect(patient).to have_attributes( |
| 279 | + address_postcode: "SW1A 1AA", |
| 280 | + family_name: "Smith", |
| 281 | + gender_code: "male", |
| 282 | + given_name: "Jimmy", |
| 283 | + nhs_number: "1234567890", |
| 284 | + address_line_1: "10 Downing Street", |
| 285 | + preferred_given_name: "Jim", |
| 286 | + preferred_family_name: "Smithy", |
| 287 | + address_town: "London" |
| 288 | + ) |
| 289 | + end |
| 290 | + |
| 291 | + it "doesn't stage the capitalisation differences" do |
| 292 | + expect(patient.pending_changes).to be_empty |
| 293 | + end |
| 294 | + end |
224 | 295 | end
|
225 | 296 |
|
226 | 297 | describe "#to_school_move" do
|
|
0 commit comments