From b081948bb3e1a6874f133140bf07e7fb9d3359d9 Mon Sep 17 00:00:00 2001 From: Kabari Hendrick Date: Sun, 14 Mar 2010 01:33:45 -0600 Subject: fixing inconsistency with cattr_reader and matter_reader [#4172 state:resolved] Signed-off-by: wycats --- activesupport/test/core_ext/class/attribute_accessor_test.rb | 8 +++++++- activesupport/test/core_ext/module/attribute_accessor_test.rb | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/class/attribute_accessor_test.rb b/activesupport/test/core_ext/class/attribute_accessor_test.rb index 2214ba9894..0f579d12e5 100644 --- a/activesupport/test/core_ext/class/attribute_accessor_test.rb +++ b/activesupport/test/core_ext/class/attribute_accessor_test.rb @@ -5,7 +5,8 @@ class ClassAttributeAccessorTest < Test::Unit::TestCase def setup @class = Class.new do cattr_accessor :foo - cattr_accessor :bar, :instance_writer => false + cattr_accessor :bar, :instance_writer => false + cattr_reader :shaq, :instance_reader => false end @object = @class.new end @@ -29,4 +30,9 @@ class ClassAttributeAccessorTest < Test::Unit::TestCase assert @object.respond_to?(:bar) assert !@object.respond_to?(:bar=) end + + def test_should_not_create_instance_reader + assert @class.respond_to?(:shaq) + assert !@object.respond_to?(:shaq) + end end diff --git a/activesupport/test/core_ext/module/attribute_accessor_test.rb b/activesupport/test/core_ext/module/attribute_accessor_test.rb index bd9461e62c..263e78feaa 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_test.rb @@ -6,6 +6,7 @@ class ModuleAttributeAccessorTest < Test::Unit::TestCase m = @module = Module.new do mattr_accessor :foo mattr_accessor :bar, :instance_writer => false + mattr_reader :shaq, :instance_reader => false end @class = Class.new @class.instance_eval { include m } @@ -31,4 +32,9 @@ class ModuleAttributeAccessorTest < Test::Unit::TestCase assert @object.respond_to?(:bar) assert !@object.respond_to?(:bar=) end + + def test_should_not_create_instance_reader + assert @module.respond_to?(:shaq) + assert !@object.respond_to?(:shaq) + end end -- cgit v1.2.3