Sha256: 2f87adc6f3036e05165e8c7e43c0f57826ed30239e5606947396c87511f86a4f

Contents?: true

Size: 648 Bytes

Versions: 5

Compression:

Stored size: 648 Bytes

Contents

require 'anise/attribute'

class Test_Attribute < Test::Unit::TestCase
  class X
    include Anise::Attribute
    attr :q
    attr :a, :x => 1
  end

  def test_attr_a
    assert_equal( {:x=>1}, X.ann(:a) )
  end
end

class Test_Attribute_Using_Attr < Test::Unit::TestCase
  class A
    include Anise::Attribute
    attr :x, :cast=>"to_s"
  end

  def test_01
    assert_equal( "to_s", A.ann(:x,:cast) )
  end
end

class Test_Attribute_Using_Attr_Accessor < Test::Unit::TestCase
  class A
    include Anise::Attribute
    attr_accessor :x, :cast=>"to_s"
  end

  def test_01
    a = A.new
    assert_equal( [:x], A.instance_attributes )
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
anise-0.2.0 test/test_attribute.rb
anise-0.2.1 test/test_attribute.rb
anise-0.2.2 test/test_attribute.rb
anise-0.3.0 test/test_attribute.rb
anise-0.4.0 test/test_attribute.rb