Sha256: 508dba3681cccf3cc6da162948f514355057190b24a809e60f66cea9c998005a

Contents?: true

Size: 626 Bytes

Versions: 16

Compression:

Stored size: 626 Bytes

Contents

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

require 'rubygems'
require 'test/unit'
require 'valuable.rb'
require 'mocha'

class Parent < Valuable
  has_value :name, :default => 'unknown'
end

class Child < Parent
  has_value :age
end

class InheritanceTest < Test::Unit::TestCase

  def test_that_children_inherit_their_parents_attributes
    assert Child.attributes.include?(:name)
  end	  

  def test_that_children_have_distinctive_attributes
    assert Child.attributes.include?(:age)
  end

  def test_that_parents_do_not_inherit_things_from_children
    assert_equal [:name], Parent.attributes
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
valuable-0.9.12 test/inheritance_test.rb
valuable-0.9.11 test/inheritance_test.rb
valuable-0.9.10 test/inheritance_test.rb
valuable-0.9.9 test/inheritance_test.rb
valuable-0.9.8 test/inheritance_test.rb
valuable-0.9.7 test/inheritance_test.rb
valuable-0.9.6 test/inheritance_test.rb
valuable-0.9.5 test/inheritance_test.rb
valuable-0.9.4 test/inheritance_test.rb
valuable-0.9.3 test/inheritance_test.rb
valuable-0.9.2 test/inheritance_test.rb
valuable-0.9.1 test/inheritance_test.rb
valuable-0.9.0 test/inheritance_test.rb
valuable-0.8.5 test/inheritance_test.rb
valuable-0.8.4 test/inheritance_test.rb
valuable-0.8.2 test/inheritance_test.rb