mongoid/mongoid — pull request #2839 by lailsonbm (2013-02-17 12:33:25+00:00)
Title: Provide the type casted attribute for validation by default

In ActiveModel, it seems to be a convention to let each validator call the value before type cast if it needs to. (And the numericality validator seems to be the only one doing this right now.)

This pull request is very simple and has no tests. I thought a lot about this and the only way to properly do this would be creating examples to test the expected behavior of each validator in ActiveModel. In one way this is strange, because we would test something completely outside mongoid. If we are just following an (undocumented) ActiveModel convention that should be sufficient. In other way, these tests are the only way to avoid regressions. Can we see them as a sort of _integration_ tests? What do you think?

Closes #2828.