提交 000a8ed9 编写于 作者: R Rick Olson

fixed lifecycle tests so they instantiate the observers

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4685 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 26eefd79
......@@ -75,6 +75,7 @@ def test_before_destroy
def test_after_save
ActiveRecord::Base.observers = :topic_manual_observer
ActiveRecord::Base.instantiate_observers
topic = Topic.find(1)
topic.title = "hello"
......@@ -86,6 +87,7 @@ def test_after_save
def test_observer_update_on_save
ActiveRecord::Base.observers = TopicManualObserver
ActiveRecord::Base.instantiate_observers
topic = Topic.find(1)
assert TopicManualObserver.instance.has_been_notified?
......@@ -130,6 +132,6 @@ def test_observing_subclasses
end
def test_invalid_observer
assert_raise(ArgumentError) { Topic.observers = Object.new }
assert_raise(ArgumentError) { Topic.observers = Object.new; Topic.instantiate_observers }
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册