aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/class
diff options
context:
space:
mode:
authorEvan Phoenix <ephoenix@engineyard.com>2010-03-22 09:54:06 -0700
committerEvan Phoenix <ephoenix@engineyard.com>2010-03-22 10:00:04 -0700
commitab3503b496b2f489391c6cc76240d8516182a2c1 (patch)
treeb6806eb0c9665610149e77589bb5cd60d9390d3d /activesupport/test/core_ext/class
parent0b608abeb8fea251d4613458e23bf2b6d564ff60 (diff)
downloadrails-ab3503b496b2f489391c6cc76240d8516182a2c1.tar.gz
rails-ab3503b496b2f489391c6cc76240d8516182a2c1.tar.bz2
rails-ab3503b496b2f489391c6cc76240d8516182a2c1.zip
Remove test ordering bug
Don't reuse classes with class attributes when testing different use cases of class attributes.
Diffstat (limited to 'activesupport/test/core_ext/class')
-rw-r--r--activesupport/test/core_ext/class/delegating_attributes_test.rb22
1 files changed, 14 insertions, 8 deletions
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