fix(EmailCheckerController): with partial email, should not raise error
This commit is contained in:
parent
06b8194359
commit
d1e983ed97
2 changed files with 10 additions and 0 deletions
|
@ -627,6 +627,8 @@ class EmailChecker
|
|||
return { success: true } if similar_domains.empty?
|
||||
|
||||
{ success: true, email_suggestions: email_suggestions(parsed_email:, similar_domains:) }
|
||||
rescue Mail::Field::IncompleteParseError
|
||||
return { success: false }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -35,5 +35,13 @@ describe EmailCheckerController, type: :controller do
|
|||
expect(body).to eq({ success: false })
|
||||
end
|
||||
end
|
||||
|
||||
context 'incomplete' do
|
||||
let(:params) { { email: 'bikram.subedi81@' } }
|
||||
it do
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(body).to eq({ success: false })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue