Fix Active Model observer tests

This commit is contained in:
Jeremy Kemper 2010-04-16 13:14:52 -07:00
parent 2161b8745a
commit 1924cff934
2 changed files with 4 additions and 2 deletions

View File

@ -52,6 +52,10 @@ module ActiveModel
end
end
def count_observers
@observer_instances.size
end
protected
def instantiate_observer(observer) #:nodoc:
# string/symbol

View File

@ -121,13 +121,11 @@ class ObserverTest < ActiveModel::TestCase
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