Froze rails gems
[depot.git] / vendor / rails / activerecord / test / cases / class_inheritable_attributes_test.rb
1 require 'test/unit'
2 require "cases/helper"
3 require 'active_support/core_ext/class/inheritable_attributes'
4
5 class A
6 include ClassInheritableAttributes
7 end
8
9 class B < A
10 write_inheritable_array "first", [ :one, :two ]
11 end
12
13 class C < A
14 write_inheritable_array "first", [ :three ]
15 end
16
17 class D < B
18 write_inheritable_array "first", [ :four ]
19 end
20
21
22 class ClassInheritableAttributesTest < ActiveRecord::TestCase
23 def test_first_level
24 assert_equal [ :one, :two ], B.read_inheritable_attribute("first")
25 assert_equal [ :three ], C.read_inheritable_attribute("first")
26 end
27
28 def test_second_level
29 assert_equal [ :one, :two, :four ], D.read_inheritable_attribute("first")
30 assert_equal [ :one, :two ], B.read_inheritable_attribute("first")
31 end
32 end