From 34497c0b3638e7fd298da4a1107333fe534f9ca4 Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Tue, 16 Mar 2010 13:51:26 -0700 Subject: [PATCH] Remove test ordering bug by using another class --- activerecord/test/cases/callbacks_test.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/activerecord/test/cases/callbacks_test.rb b/activerecord/test/cases/callbacks_test.rb index 58194993f2..dc7f82b001 100644 --- a/activerecord/test/cases/callbacks_test.rb +++ b/activerecord/test/cases/callbacks_test.rb @@ -43,6 +43,11 @@ class CallbackDeveloper < ActiveRecord::Base end end +class CallbackDeveloperWithFalseValidation < CallbackDeveloper + before_validation proc { |model| model.history << [:before_validation, :returning_false]; return false } + before_validation proc { |model| model.history << [:before_validation, :should_never_get_here] } +end + class ParentDeveloper < ActiveRecord::Base set_table_name 'developers' attr_accessor :after_save_called @@ -437,10 +442,8 @@ class CallbacksTest < ActiveRecord::TestCase end private :assert_save_callbacks_not_called - def test_zzz_callback_returning_false # must be run last since we modify CallbackDeveloper - david = CallbackDeveloper.find(1) - CallbackDeveloper.before_validation proc { |model| model.history << [:before_validation, :returning_false]; return false } - CallbackDeveloper.before_validation proc { |model| model.history << [:before_validation, :should_never_get_here] } + def test_callback_returning_false + david = CallbackDeveloperWithFalseValidation.find(1) david.save assert_equal [ [ :after_find, :method ],