diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2010-05-08 23:27:49 +0300 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-05-08 23:51:36 +0300 |
commit | 66913a76af9969ddf12021992eeb418e270bebe2 (patch) | |
tree | 8ff5d8cf518f086979fd4e4b0633c7f8c340323e /activemodel/test/cases/validations/presence_validation_test.rb | |
parent | 82485068f8b64a49cbb6529d17dd5de27c28e951 (diff) | |
download | rails-66913a76af9969ddf12021992eeb418e270bebe2.tar.gz rails-66913a76af9969ddf12021992eeb418e270bebe2.tar.bz2 rails-66913a76af9969ddf12021992eeb418e270bebe2.zip |
removed use of AR in AMo tests and removed testing of scopes (:on) in individual validation tests and moved them to their own test file
Diffstat (limited to 'activemodel/test/cases/validations/presence_validation_test.rb')
-rw-r--r-- | activemodel/test/cases/validations/presence_validation_test.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/activemodel/test/cases/validations/presence_validation_test.rb b/activemodel/test/cases/validations/presence_validation_test.rb index c4d787dadb..7fc78b1835 100644 --- a/activemodel/test/cases/validations/presence_validation_test.rb +++ b/activemodel/test/cases/validations/presence_validation_test.rb @@ -19,26 +19,26 @@ class PresenceValidationTest < ActiveModel::TestCase def test_validate_presences Topic.validates_presence_of(:title, :content) - t = Topic.create - assert !t.save + t = Topic.new + assert t.invalid? assert_equal ["can't be blank"], t.errors[:title] assert_equal ["can't be blank"], t.errors[:content] t.title = "something" t.content = " " - assert !t.save + assert t.invalid? assert_equal ["can't be blank"], t.errors[:content] t.content = "like stuff" - assert t.save + assert t.valid? end test 'accepts array arguments' do Topic.validates_presence_of %w(title content) t = Topic.new - assert !t.valid? + assert t.invalid? assert_equal ["can't be blank"], t.errors[:title] assert_equal ["can't be blank"], t.errors[:content] end @@ -46,7 +46,7 @@ class PresenceValidationTest < ActiveModel::TestCase def test_validates_acceptance_of_with_custom_error_using_quotes Person.validates_presence_of :karma, :message => "This string contains 'single' and \"double\" quotes" p = Person.new - assert !p.valid? + assert p.invalid? assert_equal "This string contains 'single' and \"double\" quotes", p.errors[:karma].last end |