AS::BasicObject can be inherited from
This commit is contained in:
parent
8f8397e0a4
commit
bb1d3c1f8e
|
@ -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
|
Loading…
Reference in New Issue