aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/class/class_inheritable_attributes_test.rb')
-rw-r--r--activesupport/test/core_ext/class/class_inheritable_attributes_test.rb27
1 files changed, 16 insertions, 11 deletions
diff --git a/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb b/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
index 63ea46b564..020dfce56a 100644
--- a/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
+++ b/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
@@ -3,9 +3,14 @@ require 'active_support/core_ext/class/inheritable_attributes'
class ClassInheritableAttributesTest < Test::Unit::TestCase
def setup
+ ActiveSupport::Deprecation.silenced = true
@klass = Class.new
end
+ def teardown
+ ActiveSupport::Deprecation.silenced = false
+ end
+
def test_reader_declaration
assert_nothing_raised do
@klass.class_inheritable_reader :a
@@ -21,7 +26,7 @@ class ClassInheritableAttributesTest < Test::Unit::TestCase
assert_respond_to @klass.new, :a=
end
end
-
+
def test_writer_declaration_without_instance_writer
assert_nothing_raised do
@klass.class_inheritable_writer :a, :instance_writer => false
@@ -39,7 +44,7 @@ class ClassInheritableAttributesTest < Test::Unit::TestCase
assert_respond_to @klass.new, :a=
end
end
-
+
def test_accessor_declaration_without_instance_writer
assert_nothing_raised do
@klass.class_inheritable_accessor :a, :instance_writer => false
@@ -176,37 +181,37 @@ class ClassInheritableAttributesTest < Test::Unit::TestCase
assert_equal 'b', @klass.b
assert_equal 'B', @sub.b
end
-
+
def test_array_inheritance
@klass.class_inheritable_accessor :a
@klass.a = []
@sub = eval("class SubbyArray < @klass; end; SubbyArray")
-
+
assert_equal [], @klass.a
assert_equal [], @sub.a
-
+
@sub.a << :first
-
+
assert_equal [:first], @sub.a
assert_equal [], @klass.a
end
-
+
def test_array_inheritance_
@klass.class_inheritable_accessor :a
@klass.a = {}
@sub = eval("class SubbyHash < @klass; end; SubbyHash")
-
+
assert_equal Hash.new, @klass.a
assert_equal Hash.new, @sub.a
-
+
@sub.a[:first] = :first
-
+
assert_equal 1, @sub.a.keys.size
assert_equal 0, @klass.a.keys.size
end
-
+
def test_reset_inheritable_attributes
@klass.class_inheritable_accessor :a
@klass.a = 'a'