email validator: fix undeliverable? method always returning false.

`undeliverable?` calls `smtp_enabled?` which we forgot to define. It
swallowed the error so it didn't fail but it always returned false.
This commit is contained in:
evazion
2020-03-27 12:46:56 -05:00
parent d24c746417
commit cbfa8c4904
2 changed files with 8 additions and 0 deletions

View File

@@ -63,6 +63,10 @@ module EmailValidator
"gmx.us" => "gmx.net",
}
def smtp_enabled?
Rails.env.production?
end
def normalize(address)
return nil unless address.count("@") == 1

View File

@@ -2,6 +2,10 @@ require 'test_helper'
class EmailValidatorTest < ActiveSupport::TestCase
context "EmailValidator" do
setup do
EmailValidator.stubs(:smtp_enabled?).returns(true)
end
context "#undeliverable?" do
should "return good addresses as deliverable" do
assert_equal(false, EmailValidator.undeliverable?("webmaster@danbooru.donmai.us"))