diff options
author | Evan Phoenix <ephoenix@engineyard.com> | 2010-03-22 09:52:07 -0700 |
---|---|---|
committer | Evan Phoenix <ephoenix@engineyard.com> | 2010-03-22 10:00:04 -0700 |
commit | 79b08616244b31b7e63a46d9a6492bc7e67c2813 (patch) | |
tree | 3188d3e15eaa6414123e615f8a59135300c8bddb | |
parent | a307fd6bd37d12d8ad6baa7e7fcfd0207e8b354a (diff) | |
download | rails-79b08616244b31b7e63a46d9a6492bc7e67c2813.tar.gz rails-79b08616244b31b7e63a46d9a6492bc7e67c2813.tar.bz2 rails-79b08616244b31b7e63a46d9a6492bc7e67c2813.zip |
Remove obsolete use case that was broken in AR::Observers
-rw-r--r-- | activerecord/test/cases/lifecycle_test.rb | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/activerecord/test/cases/lifecycle_test.rb b/activerecord/test/cases/lifecycle_test.rb index aa7ce2ecb6..fcad3e90d3 100644 --- a/activerecord/test/cases/lifecycle_test.rb +++ b/activerecord/test/cases/lifecycle_test.rb @@ -6,25 +6,6 @@ require 'models/minimalistic' class SpecialDeveloper < Developer; end -class TopicManualObserver - include Singleton - - attr_reader :action, :object, :callbacks - - def initialize - Topic.add_observer(self) - @callbacks = [] - end - - def update(callback_method, object) - @callbacks << { "callback_method" => callback_method, "object" => object } - end - - def has_been_notified? - !@callbacks.empty? - end -end - class TopicaAuditor < ActiveRecord::Observer observe :topic @@ -85,27 +66,6 @@ class LifecycleTest < ActiveRecord::TestCase assert_equal original_count - (1 + topic_to_be_destroyed.replies.size), Topic.count end - def test_after_save - ActiveRecord::Base.observers = :topic_manual_observer - ActiveRecord::Base.instantiate_observers - - topic = Topic.find(1) - topic.title = "hello" - topic.save - - assert TopicManualObserver.instance.has_been_notified? - assert_equal :after_save, TopicManualObserver.instance.callbacks.last["callback_method"] - end - - def test_observer_update_on_save - ActiveRecord::Base.observers = TopicManualObserver - ActiveRecord::Base.instantiate_observers - - topic = Topic.find(1) - assert TopicManualObserver.instance.has_been_notified? - assert_equal :after_find, TopicManualObserver.instance.callbacks.first["callback_method"] - end - def test_auto_observer topic_observer = TopicaAuditor.instance assert_nil TopicaAuditor.observed_class |