mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
fixed lifecycle tests so they instantiate the observers
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4685 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -75,6 +75,7 @@ class LifecycleTest < Test::Unit::TestCase
|
||||
|
||||
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 @@ class LifecycleTest < Test::Unit::TestCase
|
||||
|
||||
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 @@ class LifecycleTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_invalid_observer
|
||||
assert_raise(ArgumentError) { Topic.observers = Object.new }
|
||||
assert_raise(ArgumentError) { Topic.observers = Object.new; Topic.instantiate_observers }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user