fix: downcase email before finding (#8921)
* fix: downcase email when finding * feat: add `from_email` class * refactor: use `from_email` * feat: add rule to disallow find_by email directly * chore: remove redundant test Since the previous imlpmentation didn't do a case-insentive search, a new user would be created, and the error would be raised at the DB layer. With the new changes, this test case is redundant * refactor: use from_email
This commit is contained in:
@@ -111,7 +111,7 @@ RSpec.describe DataImportJob do
|
||||
|
||||
described_class.perform_now(existing_data_import)
|
||||
expect(existing_data_import.account.contacts.count).to eq(csv_length)
|
||||
contact = Contact.find_by(email: csv_data[0]['email'])
|
||||
contact = Contact.from_email(csv_data[0]['email'])
|
||||
expect(contact).to be_present
|
||||
expect(contact.phone_number).to eq("+#{csv_data[0]['phone_number']}")
|
||||
expect(contact.name).to eq((csv_data[0]['name']).to_s)
|
||||
|
||||
Reference in New Issue
Block a user