Sha256: 1da9a944b1b8a1e1e23abd8d619bc2970885ce39ba3dabe1bdef5ed7b1d9bc6a
Contents?: true
Size: 956 Bytes
Versions: 6
Compression:
Stored size: 956 Bytes
Contents
require File.dirname(__FILE__)+'/../abstract_unit' require 'gorillib/metaprogramming/cattr_accessor' class ClassAttributeAccessorTest < Test::Unit::TestCase def setup @class = Class.new do cattr_accessor :foo cattr_accessor :bar, :instance_writer => false cattr_reader :shaq, :instance_reader => false end @object = @class.new end def test_should_use_mattr_default assert_nil @class.foo assert_nil @object.foo end def test_should_set_mattr_value @class.foo = :test assert_equal :test, @object.foo @object.foo = :test2 assert_equal :test2, @class.foo end def test_should_not_create_instance_writer assert_respond_to @class, :foo assert_respond_to @class, :foo= assert_respond_to @object, :bar assert !@object.respond_to?(:bar=) end def test_should_not_create_instance_reader assert_respond_to @class, :shaq assert !@object.respond_to?(:shaq) end end
Version data entries
6 entries across 6 versions & 1 rubygems