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:
@@ -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
|
||||
|
||||
|
||||
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user