Renamed helpers to correspond to renamed Controller classes.
[merb_radiant.git] / radiant_specs / test / unit / .svn / text-base / annotatable_test.rb.svn-base
blob7918dd3e7f78109fbac97ffc0c1acd4ac3b2e2c3
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'annotatable'
4 class AnnotatableTest < Test::Unit::TestCase
5   class A
6     @@inherited_called = false
7     def self.inherited(subclass)
8       @@inherited_called = true
9     end
10     def self.inherited_called
11       @@inherited_called
12     end
13     
14     include Annotatable
15     annotate :description, :url
16     annotate :another, :inherit => true
17     
18     description "just a test"
19     another     "inherit me"
20   end
21   
22   class B < A
23     url "http://test.host"
24   end
25   
26   class C < B
27     description "something else"
28     another     "still inherit me"
29   end
30   
31   class D < C; end
32   
33   def test_superclass
34     assert_equal "just a test",      A.description
35     assert_equal nil,                A.url
36     assert_equal "inherit me",       A.another
38     assert_equal "just a test",      A.new.description
39     assert_equal nil,                A.new.url
40     assert_equal "inherit me",       A.new.another
41   end
42   
43   def test_subclass_B
44     assert_equal nil,                B.description
45     assert_equal "http://test.host", B.url
46     assert_equal "inherit me",       B.another
48     assert_equal nil,                B.new.description
49     assert_equal "http://test.host", B.new.url
50     assert_equal "inherit me",       B.new.another
51   end
52   
53   def test_subclass_C
54     assert_equal "something else",   C.description
55     assert_equal nil,                C.url
56     assert_equal "still inherit me", C.another
58     assert_equal "something else",   C.new.description
59     assert_equal nil,                C.new.url
60     assert_equal "still inherit me", C.new.another
61   end
62   
63   def test_subclass_D
64     assert_equal nil,                D.description
65     assert_equal nil,                D.url
66     assert_equal "still inherit me", D.another
68     assert_equal nil,                D.new.description
69     assert_equal nil,                D.new.url
70     assert_equal "still inherit me", D.new.another
71   end
72   
73   def test_super_called_in_inherited
74     assert A.inherited_called
75   end
76 end