Sha256: 7b517b749a9b6ed2ef532a758dbb24a2d71826ae67b1e9d6629fa052c91f6c69

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

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

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

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

2 entries across 2 versions & 1 rubygems

Version Path
valuable-0.9.14 test/inheritance_test.rb
valuable-0.9.13 test/inheritance_test.rb