Sha256: 9c22ee15916dccc8a7ccd5fbb058faf58da9490e39e20120d804217176dce0b1

Contents?: true

Size: 627 Bytes

Versions: 8

Compression:

Stored size: 627 Bytes

Contents

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

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

module BookCollection
end

module PirateFormatter
  def to_pirate
    "#{self}, ARRRGGGhhhhh!"
  end
end

class Series < Valuable
  has_collection :books, :extend => BookCollection
  has_value :name, :extend => PirateFormatter
end

class ExtendingTest < Test::Unit::TestCase
  def test_that_collections_are_extended
    assert Series.new.books.is_a?(BookCollection)
  end

  def test_that_values_are_extended
    assert_equal 'Walk The Plank, ARRRGGGhhhhh!', Series.new(:name => 'Walk The Plank').name.to_pirate
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
valuable-0.9.14 test/extending_test.rb
valuable-0.9.13 test/extending_test.rb
valuable-0.9.12 test/extending_test.rb
valuable-0.9.11 test/extending_test.rb
valuable-0.9.10 test/extending_test.rb
valuable-0.9.9 test/extending_test.rb
valuable-0.9.8 test/extending_test.rb
valuable-0.9.7 test/extending_test.rb