mirror of https://github.com/rails/rails
Delete AS::Dependencies.depend_on
This commit is contained in:
parent
cb0c746b7d
commit
627037fa8b
|
@ -301,21 +301,6 @@ module ActiveSupport # :nodoc:
|
|||
mechanism == :load
|
||||
end
|
||||
|
||||
def depend_on(file_name, message = "No such file to load -- %s.rb")
|
||||
path = search_for_file(file_name)
|
||||
require_or_load(path || file_name)
|
||||
rescue LoadError => load_error
|
||||
if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1]
|
||||
load_error_message = if load_error.respond_to?(:original_message)
|
||||
load_error.original_message
|
||||
else
|
||||
load_error.message
|
||||
end
|
||||
load_error_message.replace(message % file_name)
|
||||
end
|
||||
raise
|
||||
end
|
||||
|
||||
def clear
|
||||
Dependencies.unload_interlock do
|
||||
loaded.clear
|
||||
|
|
|
@ -28,24 +28,6 @@ class DependenciesTest < ActiveSupport::TestCase
|
|||
$LOAD_PATH.pop
|
||||
end
|
||||
|
||||
def test_depend_on_path
|
||||
expected = assert_raises(LoadError) do
|
||||
Kernel.require "omgwtfbbq"
|
||||
end
|
||||
|
||||
e = assert_raises(LoadError) do
|
||||
ActiveSupport::Dependencies.depend_on "omgwtfbbq"
|
||||
end
|
||||
assert_equal expected.path, e.path
|
||||
end
|
||||
|
||||
def test_depend_on_message
|
||||
e = assert_raises(LoadError) do
|
||||
ActiveSupport::Dependencies.depend_on "omgwtfbbq"
|
||||
end
|
||||
assert_equal "No such file to load -- omgwtfbbq.rb", e.message
|
||||
end
|
||||
|
||||
def test_smart_name_error_strings
|
||||
e = assert_raise NameError do
|
||||
Object.module_eval "ImaginaryObject"
|
||||
|
|
Loading…
Reference in New Issue