1 require File.dirname(__FILE__) + '/../test_helper'
4 class AnnotatableTest < Test::Unit::TestCase
6 @@inherited_called = false
7 def self.inherited(subclass)
8 @@inherited_called = true
10 def self.inherited_called
15 annotate :description, :url
16 annotate :another, :inherit => true
18 description "just a test"
23 url "http://test.host"
27 description "something else"
28 another "still inherit me"
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
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
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
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
73 def test_super_called_in_inherited
74 assert A.inherited_called