aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
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