Sha256: 292d56a0ea098955df3b724d3ae17ecce905d08ae81e88a662fb62bc6c3e5323

Contents?: true

Size: 755 Bytes

Versions: 4

Compression:

Stored size: 755 Bytes

Contents

require 'test/unit'
require 'abstract_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

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-1.13.0 test/class_inheritable_attributes_test.rb
activerecord-1.12.2 test/class_inheritable_attributes_test.rb
activerecord-1.13.1 test/class_inheritable_attributes_test.rb
activerecord-1.13.2 test/class_inheritable_attributes_test.rb