aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-01-24 03:04:48 +0000
committerRick Olson <technoweenie@gmail.com>2007-01-24 03:04:48 +0000
commitd5bd679340819d22c27d6074d01d05ba824c174c (patch)
tree5a4aaa7e8daddb3f6409bc208122ce2e0fd6caec /activerecord
parentf49e449ed5d140b63f30ac046826f81c04e8333d (diff)
downloadrails-d5bd679340819d22c27d6074d01d05ba824c174c.tar.gz
rails-d5bd679340819d22c27d6074d01d05ba824c174c.tar.bz2
rails-d5bd679340819d22c27d6074d01d05ba824c174c.zip
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
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rw-r--r--activerecord/test/callbacks_test.rb23
2 files changed, 25 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 004941566c..151e219d0b 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -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]
diff --git a/activerecord/test/callbacks_test.rb b/activerecord/test/callbacks_test.rb
index fa2e3da774..6ec27e2455 100644
--- a/activerecord/test/callbacks_test.rb
+++ b/activerecord/test/callbacks_test.rb
@@ -49,6 +49,16 @@ class CallbackDeveloper < ActiveRecord::Base
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 @@ class CallbacksTest < Test::Unit::TestCase
[ :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