aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/class
diff options
context:
space:
mode:
authorAkshay Vishnoi <akshay.vishnoi@vinsol.com>2014-03-20 18:29:09 +0530
committerAkshay Vishnoi <akshay.vishnoi@vinsol.com>2014-03-20 18:29:09 +0530
commit41548df342197ac5bf2556f3fa508be6e090ca70 (patch)
tree2a3027d7cb2189954ee6e98b46b0d9d95e5e7255 /activesupport/test/core_ext/class
parent8cea8ae278c0e0417e5d58a387cc5d31c0590251 (diff)
downloadrails-41548df342197ac5bf2556f3fa508be6e090ca70.tar.gz
rails-41548df342197ac5bf2556f3fa508be6e090ca70.tar.bz2
rails-41548df342197ac5bf2556f3fa508be6e090ca70.zip
Deprecate Class#superclass_delegating_accessor
Diffstat (limited to 'activesupport/test/core_ext/class')
-rw-r--r--activesupport/test/core_ext/class/delegating_attributes_test.rb34
1 files changed, 28 insertions, 6 deletions
diff --git a/activesupport/test/core_ext/class/delegating_attributes_test.rb b/activesupport/test/core_ext/class/delegating_attributes_test.rb
index 0e0742d147..86193c2b07 100644
--- a/activesupport/test/core_ext/class/delegating_attributes_test.rb
+++ b/activesupport/test/core_ext/class/delegating_attributes_test.rb
@@ -6,14 +6,18 @@ module DelegatingFixtures
end
class Child < Parent
- superclass_delegating_accessor :some_attribute
+ ActiveSupport::Deprecation.silence do
+ superclass_delegating_accessor :some_attribute
+ end
end
class Mokopuna < Child
end
class PercysMom
- superclass_delegating_accessor :superpower
+ ActiveSupport::Deprecation.silence do
+ superclass_delegating_accessor :superpower
+ end
end
class Percy < PercysMom
@@ -29,7 +33,10 @@ class DelegatingAttributesTest < ActiveSupport::TestCase
end
def test_simple_accessor_declaration
- single_class.superclass_delegating_accessor :both
+ ActiveSupport::Deprecation.silence do
+ single_class.superclass_delegating_accessor :both
+ end
+
# Class should have accessor and mutator
# the instance should have an accessor only
assert_respond_to single_class, :both
@@ -40,7 +47,11 @@ class DelegatingAttributesTest < ActiveSupport::TestCase
def test_simple_accessor_declaration_with_instance_reader_false
_instance_methods = single_class.public_instance_methods
- single_class.superclass_delegating_accessor :no_instance_reader, :instance_reader => false
+
+ ActiveSupport::Deprecation.silence do
+ single_class.superclass_delegating_accessor :no_instance_reader, :instance_reader => false
+ end
+
assert_respond_to single_class, :no_instance_reader
assert_respond_to single_class, :no_instance_reader=
assert !_instance_methods.include?(:no_instance_reader)
@@ -49,7 +60,9 @@ class DelegatingAttributesTest < ActiveSupport::TestCase
end
def test_working_with_simple_attributes
- single_class.superclass_delegating_accessor :both
+ ActiveSupport::Deprecation.silence do
+ single_class.superclass_delegating_accessor :both
+ end
single_class.both = "HMMM"
@@ -65,7 +78,11 @@ class DelegatingAttributesTest < ActiveSupport::TestCase
def test_child_class_delegates_to_parent_but_can_be_overridden
parent = Class.new
- parent.superclass_delegating_accessor :both
+
+ ActiveSupport::Deprecation.silence do
+ parent.superclass_delegating_accessor :both
+ end
+
child = Class.new(parent)
parent.both = "1"
assert_equal "1", child.both
@@ -97,4 +114,9 @@ class DelegatingAttributesTest < ActiveSupport::TestCase
Child.some_attribute=nil
end
+ def test_deprecation_warning
+ assert_deprecated(/superclass_delegating_accessor is deprecated/) do
+ single_class.superclass_delegating_accessor :test_attribute
+ end
+ end
end