diff options
author | Yehuda Katz <wycats@Yehuda-Katz.local> | 2009-12-28 16:19:09 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@Yehuda-Katz.local> | 2009-12-28 16:19:09 -0800 |
commit | 643862e3be1bbe004e2c1a00286b12c5bdc9849a (patch) | |
tree | e2c6749496100a45631a2faea6ff216808fe83f0 /activemodel/test/cases/validations/acceptance_validation_test.rb | |
parent | 9abbe9f0b311418b19e9c036e9b67c84a6bf2b7c (diff) | |
parent | 078ea0dfbdfa3267da13e88536dc73aa477a162c (diff) | |
download | rails-643862e3be1bbe004e2c1a00286b12c5bdc9849a.tar.gz rails-643862e3be1bbe004e2c1a00286b12c5bdc9849a.tar.bz2 rails-643862e3be1bbe004e2c1a00286b12c5bdc9849a.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activemodel/test/cases/validations/acceptance_validation_test.rb')
-rw-r--r-- | activemodel/test/cases/validations/acceptance_validation_test.rb | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/activemodel/test/cases/validations/acceptance_validation_test.rb b/activemodel/test/cases/validations/acceptance_validation_test.rb index 88e5fdb358..11c9c1edfd 100644 --- a/activemodel/test/cases/validations/acceptance_validation_test.rb +++ b/activemodel/test/cases/validations/acceptance_validation_test.rb @@ -9,9 +9,10 @@ require 'models/person' class AcceptanceValidationTest < ActiveModel::TestCase include ActiveModel::TestsDatabase - include ActiveModel::ValidationsRepairHelper - repair_validations(Topic) + def teardown + Topic.reset_callbacks(:validate) + end def test_terms_of_service_agreement_no_acceptance Topic.validates_acceptance_of(:terms_of_service, :on => :create) @@ -53,28 +54,18 @@ class AcceptanceValidationTest < ActiveModel::TestCase assert t.save end - def test_validates_acceptance_of_with_custom_error_using_quotes - repair_validations(Developer) do - Developer.validates_acceptance_of :salary, :message=> "This string contains 'single' and \"double\" quotes" - d = Developer.new - d.salary = "0" - assert !d.valid? - assert_equal "This string contains 'single' and \"double\" quotes", d.errors[:salary].last - end - end - def test_validates_acceptance_of_for_ruby_class - repair_validations(Person) do - Person.validates_acceptance_of :karma + Person.validates_acceptance_of :karma - p = Person.new - p.karma = "" + p = Person.new + p.karma = "" - assert p.invalid? - assert_equal ["must be accepted"], p.errors[:karma] + assert p.invalid? + assert_equal ["must be accepted"], p.errors[:karma] - p.karma = "1" - assert p.valid? - end + p.karma = "1" + assert p.valid? + ensure + Person.reset_callbacks(:validate) end end |