Permalink
Browse files

AS::BasicObject can be inherited from

  • Loading branch information...
1 parent 8f8397e commit bb1d3c1f8eae54abae0f97440d6986e25b528b86 @rwz rwz committed Dec 15, 2012
@@ -1,7 +1,12 @@
require 'active_support/deprecation'
+require 'active_support/proxy_object'
module ActiveSupport
# :nodoc:
- # Deprecated in favor of ActiveSupport::ProxyObject
- BasicObject = Deprecation::DeprecatedConstantProxy.new('ActiveSupport::BasicObject', 'ActiveSupport::ProxyObject')
+ class BasicObject < ProxyObject
+ def self.inherited(*)
+ ::ActiveSupport::Deprecation.warn 'ActiveSupport::BasicObject is deprecated! Use ActiveSupport::ProxyObject instead.'
+ super
+ end
+ end
end
@@ -0,0 +1,12 @@
+require 'abstract_unit'
+require 'active_support/deprecation'
+require 'active_support/basic_object'
+
+
+class BasicObjectTest < ActiveSupport::TestCase
+ test 'BasicObject warns about deprecation when inherited from' do
+ warn = 'ActiveSupport::BasicObject is deprecated! Use ActiveSupport::ProxyObject instead.'
+ ActiveSupport::Deprecation.expects(:warn).with(warn).once
+ Class.new(ActiveSupport::BasicObject)
+ end
+end

0 comments on commit bb1d3c1

Please sign in to comment.