diff options
author | Matt Jankowski <matt@jankowski.online> | 2023-03-04 11:00:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-04 17:00:00 +0100 |
commit | c40d5e5a8fb02f2c603a23a1b0130b3f86a15710 (patch) | |
tree | c9c107c48bf66a957ffc70d72c41fc066a4560e7 /spec/validators | |
parent | 2f606ba1220edf29e805296939f4e5612721bbf0 (diff) |
Misc coverage improvements for validators (#23928)
Diffstat (limited to 'spec/validators')
-rw-r--r-- | spec/validators/email_mx_validator_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/validators/email_mx_validator_spec.rb b/spec/validators/email_mx_validator_spec.rb index ffb6851d0..a11b8e01e 100644 --- a/spec/validators/email_mx_validator_spec.rb +++ b/spec/validators/email_mx_validator_spec.rb @@ -41,6 +41,22 @@ describe EmailMxValidator do expect(user.errors).to_not have_received(:add) end + it 'adds an error if the TagManager fails to normalize domain' do + double = instance_double(TagManager) + allow(TagManager).to receive(:instance).and_return(double) + allow(double).to receive(:normalize_domain).with('example.com').and_raise(Addressable::URI::InvalidURIError) + + user = double(email: 'foo@example.com', errors: double(add: nil)) + subject.validate(user) + expect(user.errors).to have_received(:add) + end + + it 'adds an error if the domain email portion is blank' do + user = double(email: 'foo@', errors: double(add: nil)) + subject.validate(user) + expect(user.errors).to have_received(:add) + end + it 'adds an error if the email domain name contains empty labels' do resolver = double |