Permalink
Browse files

Remove test ordering bug by using another class

  • Loading branch information...
1 parent 3bd85e2 commit 34497c0b3638e7fd298da4a1107333fe534f9ca4 Evan Phoenix committed Mar 16, 2010
Showing with 7 additions and 4 deletions.
  1. +7 −4 activerecord/test/cases/callbacks_test.rb
@@ -43,6 +43,11 @@ def history
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 @@ def assert_save_callbacks_not_called(someone)
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 ],

0 comments on commit 34497c0

Please sign in to comment.