2017-07-09 08:06:36 -04:00
|
|
|
# frozen_string_literal: true
|
2017-07-10 09:39:13 -04:00
|
|
|
|
2016-08-06 12:03:25 -04:00
|
|
|
require "abstract_unit"
|
|
|
|
require "active_support/deprecation"
|
2010-07-21 19:51:15 -04:00
|
|
|
|
2012-01-05 20:12:46 -05:00
|
|
|
class ProxyWrappersTest < ActiveSupport::TestCase
|
2010-07-21 19:51:15 -04:00
|
|
|
Waffles = false
|
|
|
|
NewWaffles = :hamburgers
|
2010-07-26 12:57:29 -04:00
|
|
|
|
2010-07-21 19:51:15 -04:00
|
|
|
def test_deprecated_object_proxy_doesnt_wrap_falsy_objects
|
|
|
|
proxy = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(nil, "message")
|
2018-04-17 18:21:34 -04:00
|
|
|
assert_not proxy
|
2010-07-21 19:51:15 -04:00
|
|
|
end
|
2010-07-26 12:57:29 -04:00
|
|
|
|
2010-07-21 19:51:15 -04:00
|
|
|
def test_deprecated_instance_variable_proxy_doesnt_wrap_falsy_objects
|
|
|
|
proxy = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(nil, :waffles)
|
2018-04-17 18:21:34 -04:00
|
|
|
assert_not proxy
|
2010-07-21 19:51:15 -04:00
|
|
|
end
|
2010-07-26 12:57:29 -04:00
|
|
|
|
2010-07-21 19:51:15 -04:00
|
|
|
def test_deprecated_constant_proxy_doesnt_wrap_falsy_objects
|
|
|
|
proxy = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(Waffles, NewWaffles)
|
2018-04-17 18:21:34 -04:00
|
|
|
assert_not proxy
|
2010-07-21 19:51:15 -04:00
|
|
|
end
|
2010-07-26 12:57:29 -04:00
|
|
|
end
|