diff options
Diffstat (limited to 'activerecord/test/validations_test.rb')
-rwxr-xr-x | activerecord/test/validations_test.rb | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb index 27a9b21c7d..a6cdc0a706 100755 --- a/activerecord/test/validations_test.rb +++ b/activerecord/test/validations_test.rb @@ -5,10 +5,7 @@ require 'fixtures/developer' class ValidationsTest < Test::Unit::TestCase - def setup - @topic_fixtures = create_fixtures("topics") - @developers = create_fixtures("developers") - end + fixtures :topics, :developers def test_single_field_validation r = Reply.new @@ -124,3 +121,24 @@ class ValidationsTest < Test::Unit::TestCase assert developer.save end end + + +class MacroValidationsTest < Test::Unit::TestCase + fixtures :topics, :developers + + def setup + Topic.validate_confirmation(:title) + end + + def teardown + Topic.write_inheritable_attribute("validate_on_create", []) + end + + def test_title_confirmation + t = Topic.create("title" => "We should be confirmed") + assert !t.save + + t.title_confirmation = "We should be confirmed" + assert t.save + end +end
\ No newline at end of file |