Renamed helpers to correspond to renamed Controller classes.
[merb_radiant.git] / radiant_specs / test / unit / .svn / text-base / inheritable_class_attributes_test.rb.svn-base
blob7d167dc0487cb1831dd60f47f62ae8a72d6f5398
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'inheritable_class_attributes'
4 class InheritableClassAttributesTest < Test::Unit::TestCase
5   class A
6     include InheritableClassAttributes
7     
8     cattr_inheritable_reader :reader
9     @reader = :test
10     
11     cattr_inheritable_writer :writer
12     @writer = :test
13     
14     cattr_inheritable_accessor :accessor
15     @accessor = :test
16   end
17   
18   def test_inheritable_reader
19     assert_equal :test, A.reader
20   end
21   
22   def test_inheritable_writer
23     A.writer = :changed
24     assert_equal :changed, A.module_eval(%{@writer})
25   end
26   
27   def test_inheritable_accessor
28     A.accessor = :changed
29     assert_equal :changed, A.accessor
30   end
31   
32   def test_inheritance
33     A.accessor = :unchanged
34     Kernel.module_eval %{ class B < A; end }
35     B.accessor = :changed
36     assert_equal :changed, B.accessor
37     assert_equal :unchanged, A.accessor
38   end
39   
40   def test_array_inheritance
41     A.accessor = [1,2,3]
42     Kernel.module_eval %{ class C < A; end }
43     C.accessor << 4
44     assert_equal [1,2,3,4], C.accessor
45     assert_equal [1,2,3], A.accessor
46   end
47 end