diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-04-30 00:15:51 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-04-30 00:15:51 -0700 |
commit | 4cff1a28095ca93f865eaaa7b4ce0132b5256340 (patch) | |
tree | 0af8e38c5ca52e31a16d91f53e5ba9de81f196c3 /activemodel/test/cases/observing_test.rb | |
parent | 66c5ac3be9c362cd7cadb57cc60cfc48eade39db (diff) | |
parent | 17c990b153f8635874c006a7460ee95817543fc1 (diff) | |
download | rails-4cff1a28095ca93f865eaaa7b4ce0132b5256340.tar.gz rails-4cff1a28095ca93f865eaaa7b4ce0132b5256340.tar.bz2 rails-4cff1a28095ca93f865eaaa7b4ce0132b5256340.zip |
Merge pull request #6072 from marcandre/observer_simplify_test
Observer: simplify tests
Diffstat (limited to 'activemodel/test/cases/observing_test.rb')
-rw-r--r-- | activemodel/test/cases/observing_test.rb | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/activemodel/test/cases/observing_test.rb b/activemodel/test/cases/observing_test.rb index f8bfcf839d..3b636a6768 100644 --- a/activemodel/test/cases/observing_test.rb +++ b/activemodel/test/cases/observing_test.rb @@ -113,32 +113,25 @@ class ObserverTest < ActiveModel::TestCase test "tracks implicit observable models" do instance = FooObserver.new - assert instance.send(:observed_classes).include?(Foo), "Foo not in #{instance.send(:observed_classes).inspect}" - assert !instance.send(:observed_classes).include?(ObservedModel), "ObservedModel in #{instance.send(:observed_classes).inspect}" + assert_equal [Foo], old_instance.observed_classes end test "tracks explicit observed model class" do - old_instance = FooObserver.new - assert !old_instance.send(:observed_classes).include?(ObservedModel), "ObservedModel in #{old_instance.send(:observed_classes).inspect}" FooObserver.observe ObservedModel instance = FooObserver.new - assert instance.send(:observed_classes).include?(ObservedModel), "ObservedModel not in #{instance.send(:observed_classes).inspect}" + assert_equal [ObservedModel], instance.observed_classes end test "tracks explicit observed model as string" do - old_instance = FooObserver.new - assert !old_instance.send(:observed_classes).include?(ObservedModel), "ObservedModel in #{old_instance.send(:observed_classes).inspect}" FooObserver.observe 'observed_model' instance = FooObserver.new - assert instance.send(:observed_classes).include?(ObservedModel), "ObservedModel not in #{instance.send(:observed_classes).inspect}" + assert_equal [ObservedModel], instance.observed_classes end test "tracks explicit observed model as symbol" do - old_instance = FooObserver.new - assert !old_instance.send(:observed_classes).include?(ObservedModel), "ObservedModel in #{old_instance.send(:observed_classes).inspect}" FooObserver.observe :observed_model instance = FooObserver.new - assert instance.send(:observed_classes).include?(ObservedModel), "ObservedModel not in #{instance.send(:observed_classes).inspect}" + assert_equal [ObservedModel], instance.observed_classes end test "calls existing observer event" do |