Skip to content
This repository
Browse code

Remove obsolete use case that was broken in AR::Observers

  • Loading branch information...
commit 79b08616244b31b7e63a46d9a6492bc7e67c2813 1 parent a307fd6
authored March 22, 2010

Showing 1 changed file with 0 additions and 40 deletions. Show diff stats Hide diff stats

  1. 40  activerecord/test/cases/lifecycle_test.rb
40  activerecord/test/cases/lifecycle_test.rb
@@ -6,25 +6,6 @@
6 6
 
7 7
 class SpecialDeveloper < Developer; end
8 8
 
9  
-class TopicManualObserver
10  
-  include Singleton
11  
-
12  
-  attr_reader :action, :object, :callbacks
13  
-
14  
-  def initialize
15  
-    Topic.add_observer(self)
16  
-    @callbacks = []
17  
-  end
18  
-
19  
-  def update(callback_method, object)
20  
-    @callbacks << { "callback_method" => callback_method, "object" => object }
21  
-  end
22  
-
23  
-  def has_been_notified?
24  
-    !@callbacks.empty?
25  
-  end
26  
-end
27  
-
28 9
 class TopicaAuditor < ActiveRecord::Observer
29 10
   observe :topic
30 11
 
@@ -85,27 +66,6 @@ def test_before_destroy
85 66
     assert_equal original_count - (1 + topic_to_be_destroyed.replies.size), Topic.count
86 67
   end
87 68
 
88  
-  def test_after_save
89  
-    ActiveRecord::Base.observers = :topic_manual_observer
90  
-    ActiveRecord::Base.instantiate_observers
91  
-
92  
-    topic = Topic.find(1)
93  
-    topic.title = "hello"
94  
-    topic.save
95  
-
96  
-    assert TopicManualObserver.instance.has_been_notified?
97  
-    assert_equal :after_save, TopicManualObserver.instance.callbacks.last["callback_method"]
98  
-  end
99  
-
100  
-  def test_observer_update_on_save
101  
-    ActiveRecord::Base.observers = TopicManualObserver
102  
-    ActiveRecord::Base.instantiate_observers
103  
-
104  
-    topic = Topic.find(1)
105  
-    assert TopicManualObserver.instance.has_been_notified?
106  
-    assert_equal :after_find, TopicManualObserver.instance.callbacks.first["callback_method"]
107  
-  end
108  
-
109 69
   def test_auto_observer
110 70
     topic_observer = TopicaAuditor.instance
111 71
     assert_nil TopicaAuditor.observed_class

0 notes on commit 79b0861

Please sign in to comment.
Something went wrong with that request. Please try again.