未验证 提交 9e4827a8 编写于 作者: B bogdanvlviv

Deprecate `Module#reachable?` method

上级 f8e4c837
* Deprecate `Module#reachable?` method.
*bogdanvlviv*
* Add `config/credentials.yml.enc` to store production app secrets.
Allows saving any authentication credentials for third party services
......
......@@ -7,4 +7,5 @@ class Module
def reachable? #:nodoc:
!anonymous? && name.safe_constantize.equal?(self)
end
deprecate :reachable?
end
......@@ -5,13 +5,17 @@
class AnonymousTest < ActiveSupport::TestCase
test "an anonymous class or module is not reachable" do
assert !Module.new.reachable?
assert !Class.new.reachable?
assert_deprecated do
assert !Module.new.reachable?
assert !Class.new.reachable?
end
end
test "ordinary named classes or modules are reachable" do
assert Kernel.reachable?
assert Object.reachable?
assert_deprecated do
assert Kernel.reachable?
assert Object.reachable?
end
end
test "a named class or module whose constant has gone is not reachable" do
......@@ -21,8 +25,10 @@ class AnonymousTest < ActiveSupport::TestCase
self.class.send(:remove_const, :C)
self.class.send(:remove_const, :M)
assert !c.reachable?
assert !m.reachable?
assert_deprecated do
assert !c.reachable?
assert !m.reachable?
end
end
test "a named class or module whose constants store different objects are not reachable" do
......@@ -35,9 +41,11 @@ class AnonymousTest < ActiveSupport::TestCase
eval "class C; end"
eval "module M; end"
assert C.reachable?
assert M.reachable?
assert !c.reachable?
assert !m.reachable?
assert_deprecated do
assert C.reachable?
assert M.reachable?
assert !c.reachable?
assert !m.reachable?
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册