Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove test ordering bug by using another class

  • Loading branch information...
commit 34497c0b3638e7fd298da4a1107333fe534f9ca4 1 parent 3bd85e2
Evan Phoenix authored
Showing with 7 additions and 4 deletions.
  1. +7 −4 activerecord/test/cases/callbacks_test.rb
11 activerecord/test/cases/callbacks_test.rb
View
@@ -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 ],
Please sign in to comment.
Something went wrong with that request. Please try again.