Permalink
Browse files

Add missing tests ensuring callbacks work with class inheritance. Closes

 #7339 [sandofsky]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6026 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
technoweenie committed Jan 24, 2007
1 parent f49e449 commit d5bd679340819d22c27d6074d01d05ba824c174c
Showing with 25 additions and 0 deletions.
  1. +2 −0 activerecord/CHANGELOG
  2. +23 −0 activerecord/test/callbacks_test.rb
@@ -1,5 +1,7 @@
*SVN*
* Add missing tests ensuring callbacks work with class inheritance. Closes #7339 [sandofsky]
* Fixtures use the table name and connection from set_fixture_class. #7330 [Anthony Eden]
* Remove useless code in #attribute_present? since 0 != blank?. Closes #7249 [Josh Susser]
@@ -49,6 +49,16 @@ def after_find
end
end
class ParentDeveloper < ActiveRecord::Base
set_table_name 'developers'
attr_accessor :after_save_called
before_validation {|record| record.after_save_called = true}
end
class ChildDeveloper < ParentDeveloper
end
class RecursiveCallbackDeveloper < ActiveRecord::Base
set_table_name 'developers'
@@ -374,4 +384,17 @@ def test_zzz_callback_returning_false # must be run last since we modify Callbac
[ :before_validation, :returning_false ]
], david.history
end
def test_inheritence_of_callbacks
parent = ParentDeveloper.new
assert !parent.after_save_called
parent.save
assert parent.after_save_called
child = ChildDeveloper.new
assert !child.after_save_called
child.save
assert child.after_save_called
end
end

0 comments on commit d5bd679

Please sign in to comment.