aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorJames Miller <bensie@gmail.com>2011-06-18 15:49:11 -0700
committerJames Miller <bensie@gmail.com>2011-06-18 15:49:11 -0700
commit0ce5fb8a2743042d05f8f43bf2ea6fb7924a2ce2 (patch)
tree3f076a9824dbc356cb1bb92d93889beff14b3c2f /activesupport/test
parent2fbb7504e2c2b0a95398d1ef0c97ea4a403d831d (diff)
downloadrails-0ce5fb8a2743042d05f8f43bf2ea6fb7924a2ce2.tar.gz
rails-0ce5fb8a2743042d05f8f43bf2ea6fb7924a2ce2.tar.bz2
rails-0ce5fb8a2743042d05f8f43bf2ea6fb7924a2ce2.zip
Add option to omit creating an instance reader method on class_attribute
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/class/attribute_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb
index d58b60482b..e290a6e012 100644
--- a/activesupport/test/core_ext/class/attribute_test.rb
+++ b/activesupport/test/core_ext/class/attribute_test.rb
@@ -60,6 +60,12 @@ class ClassAttributeTest < ActiveSupport::TestCase
assert_raise(NoMethodError) { object.setting = 'boom' }
end
+ test 'disabling instance reader' do
+ object = Class.new { class_attribute :setting, :instance_reader => false }.new
+ assert_raise(NoMethodError) { object.setting }
+ assert_raise(NoMethodError) { object.setting? }
+ end
+
test 'works well with singleton classes' do
object = @klass.new
object.singleton_class.setting = 'foo'