Permalink
Browse files

Fix Active Model observer tests

  • Loading branch information...
1 parent 2161b87 commit 1924cff93402160f4db4eea5c1b14bb9d1f85d91 @jeremy jeremy committed Apr 16, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −0 activemodel/lib/active_model/observing.rb
  2. +0 −2 activemodel/test/cases/observing_test.rb
@@ -52,6 +52,10 @@ def notify_observers(*arg)
end
end
+ def count_observers
+ @observer_instances.size
+ end
+
protected
def instantiate_observer(observer) #:nodoc:
# string/symbol
@@ -121,13 +121,11 @@ def teardown
foo = Foo.new
FooObserver.instance.stub = stub
FooObserver.instance.stub.expects(:event_with).with(foo)
- Foo.send(:changed)
Foo.send(:notify_observers, :on_spec, foo)
end
test "skips nonexistent observer event" do
foo = Foo.new
- Foo.send(:changed)
Foo.send(:notify_observers, :whatever, foo)
end
end

0 comments on commit 1924cff

Please sign in to comment.