diff options
author | Mislav Marohnić <mislav.marohnic@gmail.com> | 2010-04-16 16:20:31 +0200 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-04-16 13:09:07 -0700 |
commit | cf616e48765d1aa378d04618c044b493fd9583e1 (patch) | |
tree | 61102541b455c5827f77bb4412d7c8170514731d /activerecord/test/cases/callbacks_observers_test.rb | |
parent | 779723a0b4d9cd42bf6a494c0906723a5e3c5fec (diff) | |
download | rails-cf616e48765d1aa378d04618c044b493fd9583e1.tar.gz rails-cf616e48765d1aa378d04618c044b493fd9583e1.tar.bz2 rails-cf616e48765d1aa378d04618c044b493fd9583e1.zip |
merge callbacks_observers_test.rb into lifecycle_test.rb where other observers test reside
Benefits: test able to run independently, subclassing instead of changing the original Comment model
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test/cases/callbacks_observers_test.rb')
-rw-r--r-- | activerecord/test/cases/callbacks_observers_test.rb | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/activerecord/test/cases/callbacks_observers_test.rb b/activerecord/test/cases/callbacks_observers_test.rb deleted file mode 100644 index 52ce384844..0000000000 --- a/activerecord/test/cases/callbacks_observers_test.rb +++ /dev/null @@ -1,37 +0,0 @@ -require "cases/helper" - -class Comment < ActiveRecord::Base - attr_accessor :callers - - before_validation :record_callers - - after_validation do - record_callers - end - - def record_callers - callers << self.class if callers - end -end - -class CommentObserver < ActiveRecord::Observer - attr_accessor :callers - - def after_validation(model) - callers << self.class if callers - end -end - -class CallbacksObserversTest < ActiveRecord::TestCase - def test_model_callbacks_fire_before_observers_are_notified - callers = [] - - comment = Comment.new - comment.callers = callers - - CommentObserver.instance.callers = callers - - comment.valid? - assert_equal [Comment, Comment, CommentObserver], callers, "model callbacks did not fire before observers were notified" - end -end |