Sha256: 0d43a86b88828e94f9aef2daa801efaa6653bfa465468f28c875647b33907ddb

Contents?: true

Size: 778 Bytes

Versions: 9

Compression:

Stored size: 778 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')

require 'test/unit'
require 'active_support/class_inheritable_attributes'

class A
  include ClassInheritableAttributes
end

class B < A
  write_inheritable_array "first", [ :one, :two ]
end

class C < A
  write_inheritable_array "first", [ :three ]
end

class D < B
  write_inheritable_array "first", [ :four ]
end


class ClassInheritableAttributesTest < Test::Unit::TestCase
  def test_first_level
    assert_equal [ :one, :two ], B.read_inheritable_attribute("first")
    assert_equal [ :three ], C.read_inheritable_attribute("first")
  end
  
  def test_second_level
    assert_equal [ :one, :two, :four ], D.read_inheritable_attribute("first")
    assert_equal [ :one, :two ], B.read_inheritable_attribute("first")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activerecord-1.10.0 test/class_inheritable_attributes_test.rb
activerecord-1.11.0 test/class_inheritable_attributes_test.rb
activerecord-1.12.1 test/class_inheritable_attributes_test.rb
activerecord-1.11.1 test/class_inheritable_attributes_test.rb
activerecord-1.10.1 test/class_inheritable_attributes_test.rb
activerecord-1.8.0 test/class_inheritable_attributes_test.rb
activerecord-1.9.0 test/class_inheritable_attributes_test.rb
activerecord-1.7.0 test/class_inheritable_attributes_test.rb
activerecord-1.9.1 test/class_inheritable_attributes_test.rb