From ab3503b496b2f489391c6cc76240d8516182a2c1 Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Mon, 22 Mar 2010 09:54:06 -0700 Subject: Remove test ordering bug Don't reuse classes with class attributes when testing different use cases of class attributes. --- .../core_ext/class/delegating_attributes_test.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'activesupport') diff --git a/activesupport/test/core_ext/class/delegating_attributes_test.rb b/activesupport/test/core_ext/class/delegating_attributes_test.rb index 636edb8d4b..6d6cb61571 100644 --- a/activesupport/test/core_ext/class/delegating_attributes_test.rb +++ b/activesupport/test/core_ext/class/delegating_attributes_test.rb @@ -11,6 +11,13 @@ module DelegatingFixtures class Mokopuna < Child end + + class PercysMom + superclass_delegating_accessor :superpower + end + + class Percy < PercysMom + end end class DelegatingAttributesTest < Test::Unit::TestCase @@ -70,18 +77,17 @@ class DelegatingAttributesTest < Test::Unit::TestCase end def test_delegation_stops_at_the_right_level - assert_nil Mokopuna.some_attribute - assert_nil Child.some_attribute - Child.some_attribute="1" - assert_equal "1", Mokopuna.some_attribute - ensure - Child.some_attribute=nil + assert_nil Percy.superpower + assert_nil PercysMom.superpower + + PercysMom.superpower = :heatvision + assert_equal :heatvision, Percy.superpower end - + def test_delegation_stops_for_nil Mokopuna.some_attribute = nil Child.some_attribute="1" - + assert_equal "1", Child.some_attribute assert_nil Mokopuna.some_attribute ensure -- cgit v1.2.3