Sha256: 6385b44475041ada618b3746c258f893811c4c4b9d376abe81ba558451db35ea

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

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

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

class Software < Valuable
  has_value :name, :alias => :title
  has_value :enterprise_namespace, :alias => 'EnterpriseNamespace'
end

class AliasTest < Test::Unit::TestCase

  def test_that_values_can_be_set_using_their_alias
    software = Software.new(:title => 'PostIt')
    assert_equal 'PostIt', software.name
  end

  def test_that_aliases_can_be_strings
    software = Software.new('EnterpriseNamespace' => 'Enterprisey')
    assert_equal 'Enterprisey', software.enterprise_namespace
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
valuable-0.8.2 test/alias_test.rb