Sha256: 3959358326f422e1ddc44f6a5f771daae4dd5803edbb67f769d165424bb19e87

Contents?: true

Size: 785 Bytes

Versions: 8

Compression:

Stored size: 785 Bytes

Contents

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

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

8 entries across 8 versions & 1 rubygems

Version Path
activerecord-1.0.0 test/class_inheritable_attributes_test.rb
activerecord-1.1.0 test/class_inheritable_attributes_test.rb
activerecord-1.3.0 test/class_inheritable_attributes_test.rb
activerecord-1.2.0 test/class_inheritable_attributes_test.rb
activerecord-1.4.0 test/class_inheritable_attributes_test.rb
activerecord-1.6.0 test/class_inheritable_attributes_test.rb
activerecord-1.5.0 test/class_inheritable_attributes_test.rb
activerecord-1.5.1 test/class_inheritable_attributes_test.rb