hallelujah/valid_email — pull request #13 by dbyron0 (2013-02-06 21:49:16+00:00)
Title: add error messages such that %{value} works in custom error messages

When I use upstream like this:

validates :email, presence: true, email: { message: "\"%{value}\" is not a valid email address" }

the error message didn't have %{value} substituted with the actual invalid email address. With this pull request, the actual invalid email address does appear. There is some duplicate code between email_validator.rb and mx_validator.rb. I'm not sure what the preferred way of handling that is. I added some tests. Along the way I needed to modify the way the test classes are created for reasons I don't totally understand. Without the modification I ended up with errors like this:

Failure/Error: subject.valid?.should be_false
NameError:
undefined local variable or method `all_options' for #

So, there may be a cleaner way to do what I've done, but this should give you an idea of what I'm after. Please consider including this in your repo.

Thanks.

-DB