From 3e52d5925083f07513ae09e8242f537a58cecd84 Mon Sep 17 00:00:00 2001 From: Ross Oliver Date: Mon, 26 Jul 2021 09:55:41 +0100 Subject: [PATCH] Alias firstname/lastname The old `Contact` method had `firstname` and `lastname` but our new API model as `first_name` and `last_name`. As the `MissingContact` is used in its place in certain situations we need to have parity with the attribute names. I'm leaving in the original attributes for now as other models still use that naming convention and I don't want to inadvertently break it elsewhere. I'll go through and do a repo-wide rename of these attributes in a future PR. --- app/services/bookings/gitis/missing_contact.rb | 2 ++ spec/services/bookings/gitis/missing_contact_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/services/bookings/gitis/missing_contact.rb b/app/services/bookings/gitis/missing_contact.rb index e1ed7f3e61..14bd8b0f17 100644 --- a/app/services/bookings/gitis/missing_contact.rb +++ b/app/services/bookings/gitis/missing_contact.rb @@ -13,6 +13,8 @@ def full_name end alias_method :firstname, :full_name alias_method :lastname, :full_name + alias_method :first_name, :full_name + alias_method :last_name, :full_name def emailaddress2 nil diff --git a/spec/services/bookings/gitis/missing_contact_spec.rb b/spec/services/bookings/gitis/missing_contact_spec.rb index 896d0415a0..76e2b36396 100644 --- a/spec/services/bookings/gitis/missing_contact_spec.rb +++ b/spec/services/bookings/gitis/missing_contact_spec.rb @@ -7,6 +7,8 @@ it { is_expected.to have_attributes contactid: uuid, id: uuid } it { is_expected.to have_attributes firstname: 'Unavailable' } it { is_expected.to have_attributes lastname: 'Unavailable' } + it { is_expected.to have_attributes first_name: 'Unavailable' } + it { is_expected.to have_attributes first_name: 'Unavailable' } it { is_expected.to have_attributes full_name: 'Unavailable' } it { is_expected.to have_attributes birthdate: nil } it { is_expected.to have_attributes date_of_birth: nil }