aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/class/attribute_accessor_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/class/attribute_accessor_test.rb')
-rw-r--r--activesupport/test/core_ext/class/attribute_accessor_test.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/class/attribute_accessor_test.rb b/activesupport/test/core_ext/class/attribute_accessor_test.rb
index 6b50f8db37..8d827f054e 100644
--- a/activesupport/test/core_ext/class/attribute_accessor_test.rb
+++ b/activesupport/test/core_ext/class/attribute_accessor_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'
require 'active_support/core_ext/class/attribute_accessors'
-class ClassAttributeAccessorTest < Test::Unit::TestCase
+class ClassAttributeAccessorTest < ActiveSupport::TestCase
def setup
@class = Class.new do
cattr_accessor :foo
@@ -42,4 +42,18 @@ class ClassAttributeAccessorTest < Test::Unit::TestCase
assert !@object.respond_to?(:camp)
assert !@object.respond_to?(:camp=)
end
+
+ def test_should_raise_name_error_if_attribute_name_is_invalid
+ assert_raises NameError do
+ Class.new do
+ cattr_reader "invalid attribute name"
+ end
+ end
+
+ assert_raises NameError do
+ Class.new do
+ cattr_writer "invalid attribute name"
+ end
+ end
+ end
end