Sha256: fd5e41be48b6f17b30e5387bc088f2bfe9fc92f5ba8b96a4f4f46d4f5e1358b8
Contents?: true
Size: 613 Bytes
Versions: 61
Compression:
Stored size: 613 Bytes
Contents
require File.dirname(__FILE__) + '/../../abstract_unit' module AttributeAliasing class Content attr_accessor :title def title? !title.nil? end end class Email < Content alias_attribute :subject, :title end end class AttributeAliasingTest < Test::Unit::TestCase def test_attribute_alias e = AttributeAliasing::Email.new assert !e.subject? e.title = "Upgrade computer" assert_equal "Upgrade computer", e.subject assert e.subject? e.subject = "We got a long way to go" assert_equal "We got a long way to go", e.title assert e.title? end end
Version data entries
61 entries across 61 versions & 2 rubygems