diff options
author | Alexey Vakhov <vakhov@gmail.com> | 2012-02-25 01:29:00 +0400 |
---|---|---|
committer | Alexey Vakhov <vakhov@gmail.com> | 2012-05-22 00:28:34 +0400 |
commit | e4569b50d1d20f52633a3fe036014acd5117fa73 (patch) | |
tree | bdd7b56cecaa1ac210ba4fa46643bc010d411685 /activesupport/test/core_ext | |
parent | 776ea1090fb9ba4353035d4983cf1926a67b3294 (diff) | |
download | rails-e4569b50d1d20f52633a3fe036014acd5117fa73.tar.gz rails-e4569b50d1d20f52633a3fe036014acd5117fa73.tar.bz2 rails-e4569b50d1d20f52633a3fe036014acd5117fa73.zip |
Add instance_accessor option to class_attribute
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/class/attribute_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index e290a6e012..1c3ba8a7a0 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -66,6 +66,13 @@ class ClassAttributeTest < ActiveSupport::TestCase assert_raise(NoMethodError) { object.setting? } end + test 'disabling both instance writer and reader' do + object = Class.new { class_attribute :setting, :instance_accessor => false }.new + assert_raise(NoMethodError) { object.setting } + assert_raise(NoMethodError) { object.setting? } + assert_raise(NoMethodError) { object.setting = 'boom' } + end + test 'works well with singleton classes' do object = @klass.new object.singleton_class.setting = 'foo' |