diff options
author | José Valim <jose.valim@gmail.com> | 2011-04-11 17:47:55 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-04-11 17:47:59 +0200 |
commit | df5691aa94f209a59945d60d750a5040b24dbc40 (patch) | |
tree | 4945b12139eb5ea358974af1d9e97656c523405f /activemodel/test | |
parent | 5bf3d46becdec8705681b8914376a26a6c759dae (diff) | |
download | rails-df5691aa94f209a59945d60d750a5040b24dbc40.tar.gz rails-df5691aa94f209a59945d60d750a5040b24dbc40.tar.bz2 rails-df5691aa94f209a59945d60d750a5040b24dbc40.zip |
No need to rescue here. Invoking the wrong method in an object can happen anywhere if you are not careful. In other words, test your shit.
Diffstat (limited to 'activemodel/test')
3 files changed, 0 insertions, 34 deletions
diff --git a/activemodel/test/cases/validations/exclusion_validation_test.rb b/activemodel/test/cases/validations/exclusion_validation_test.rb index fe0d13ec33..72a383f128 100644 --- a/activemodel/test/cases/validations/exclusion_validation_test.rb +++ b/activemodel/test/cases/validations/exclusion_validation_test.rb @@ -54,13 +54,4 @@ class ExclusionValidationTest < ActiveModel::TestCase p.title = "wasabi" assert p.valid? end - - def test_validates_exclustion_with_invalid_lambda_return - Topic.validates_exclusion_of :title, :in => lambda{ |topic| false } - - p = Topic.new - p.title = "wasabi" - p.author_name = "sikachu" - assert_raise(ArgumentError){ p.valid? } - end end diff --git a/activemodel/test/cases/validations/format_validation_test.rb b/activemodel/test/cases/validations/format_validation_test.rb index 1ff29134ee..73647efea5 100644 --- a/activemodel/test/cases/validations/format_validation_test.rb +++ b/activemodel/test/cases/validations/format_validation_test.rb @@ -122,22 +122,6 @@ class PresenceValidationTest < ActiveModel::TestCase assert p.valid? end - def test_validates_format_of_with_lambda_not_returns_regexp - Topic.validates_format_of :content, :with => lambda{ |topic| false } - - p = Topic.new - p.content = "Pixies" - assert_raise(ArgumentError){ p.valid? } - end - - def test_validates_format_of_without_lambda_not_returns_regexp - Topic.validates_format_of :content, :without => lambda{ |topic| false } - - p = Topic.new - p.content = "Pixies" - assert_raise(ArgumentError){ p.valid? } - end - def test_validates_format_of_for_ruby_class Person.validates_format_of :karma, :with => /\A\d+\Z/ diff --git a/activemodel/test/cases/validations/inclusion_validation_test.rb b/activemodel/test/cases/validations/inclusion_validation_test.rb index e6adb6d187..92c473de0e 100644 --- a/activemodel/test/cases/validations/inclusion_validation_test.rb +++ b/activemodel/test/cases/validations/inclusion_validation_test.rb @@ -86,13 +86,4 @@ class InclusionValidationTest < ActiveModel::TestCase p.title = "elephant" assert p.valid? end - - def test_validates_inclustion_with_invalid_lambda_return - Topic.validates_inclusion_of :title, :in => lambda{ |topic| false } - - p = Topic.new - p.title = "monkey" - p.author_name = "sikachu" - assert_raise(ArgumentError){ p.valid? } - end end |