Skip to content
This repository
Browse code

Remove test ordering bug

Don't reuse classes with class attributes when testing different use cases
of class attributes.
  • Loading branch information...
commit ab3503b496b2f489391c6cc76240d8516182a2c1 1 parent 0b608ab
authored March 22, 2010
22  activesupport/test/core_ext/class/delegating_attributes_test.rb
@@ -11,6 +11,13 @@ class Child < Parent
11 11
 
12 12
   class Mokopuna < Child
13 13
   end
  14
+
  15
+  class PercysMom
  16
+    superclass_delegating_accessor :superpower
  17
+  end
  18
+
  19
+  class Percy < PercysMom
  20
+  end
14 21
 end
15 22
 
16 23
 class DelegatingAttributesTest < Test::Unit::TestCase
@@ -70,18 +77,17 @@ def test_child_class_delegates_to_parent_but_can_be_overridden
70 77
   end
71 78
 
72 79
   def test_delegation_stops_at_the_right_level
73  
-    assert_nil Mokopuna.some_attribute
74  
-    assert_nil Child.some_attribute
75  
-    Child.some_attribute="1"
76  
-    assert_equal "1", Mokopuna.some_attribute
77  
-  ensure
78  
-    Child.some_attribute=nil
  80
+    assert_nil Percy.superpower
  81
+    assert_nil PercysMom.superpower
  82
+
  83
+    PercysMom.superpower = :heatvision
  84
+    assert_equal :heatvision, Percy.superpower
79 85
   end
80  
-  
  86
+
81 87
   def test_delegation_stops_for_nil
82 88
     Mokopuna.some_attribute = nil
83 89
     Child.some_attribute="1"
84  
-    
  90
+
85 91
     assert_equal "1", Child.some_attribute
86 92
     assert_nil Mokopuna.some_attribute
87 93
   ensure

0 notes on commit ab3503b

Please sign in to comment.
Something went wrong with that request. Please try again.