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:
Shivam Mishra
2024-02-21 18:51:00 +05:30
committed by GitHub
parent ebae547a60
commit c031cb19d2
17 changed files with 46 additions and 18 deletions

View File

@@ -115,11 +115,6 @@ RSpec.describe 'Platform Users API', type: :request do
)
)
expect(platform_app.platform_app_permissibles.first.permissible_id).to eq data['id']
post '/platform/api/v1/users/', params: { name: 'test', email: 'TesT@test.com', password: 'Password1!' },
headers: { api_access_token: platform_app.access_token.token }, as: :json
data = response.parsed_body
expect(data['message']).to eq('Email has already been taken')
end
it 'fetch existing user and creates permissible for the user' do