diff options
author | Carl Lerche <me@carllerche.com> | 2011-02-05 15:37:38 -0800 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2011-02-05 15:37:38 -0800 |
commit | 7176ade35b4d6b167873991e0851f3fb9d46ae3b (patch) | |
tree | a4141221525f67cab26f2b0d9e2e7f1bf25c094c /activemodel/test/cases/validations | |
parent | b9309b47cda12db34ac3427fbafff2dca0314ed7 (diff) | |
download | rails-7176ade35b4d6b167873991e0851f3fb9d46ae3b.tar.gz rails-7176ade35b4d6b167873991e0851f3fb9d46ae3b.tar.bz2 rails-7176ade35b4d6b167873991e0851f3fb9d46ae3b.zip |
Do not require that validation attributes be specified as symbols
Diffstat (limited to 'activemodel/test/cases/validations')
-rw-r--r-- | activemodel/test/cases/validations/validates_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activemodel/test/cases/validations/validates_test.rb b/activemodel/test/cases/validations/validates_test.rb index 3a9900939e..431d2fd623 100644 --- a/activemodel/test/cases/validations/validates_test.rb +++ b/activemodel/test/cases/validations/validates_test.rb @@ -21,6 +21,17 @@ class ValidatesTest < ActiveModel::TestCase assert_equal ['is not a number'], person.errors[:title] end + def test_validates_with_attribute_specified_as_string + Person.validates "title", :numericality => true + person = Person.new + person.valid? + assert_equal ['is not a number'], person.errors[:title] + + person = Person.new + person.title = 123 + assert person.valid? + end + def test_validates_with_built_in_validation_and_options Person.validates :salary, :numericality => { :message => 'my custom message' } person = Person.new |