diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-11-25 06:56:05 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-11-25 06:56:05 +0900 |
commit | d99b3848bb83e147674465a82af1c2dfcc27b9cc (patch) | |
tree | 0a5bf36b14b70e4e37dd8c45a61aecbdbb6e0ef9 | |
parent | 1b795f5f0ba01ea0a5c3b9063059ad90ead41b13 (diff) | |
download | rails-d99b3848bb83e147674465a82af1c2dfcc27b9cc.tar.gz rails-d99b3848bb83e147674465a82af1c2dfcc27b9cc.tar.bz2 rails-d99b3848bb83e147674465a82af1c2dfcc27b9cc.zip |
Fix `require_dependency` message format
`depend_on` message format is `"No such file to load -- %s.rb"`.
But `require_dependency` message is missing `.rb` suffix.
```
% git grep -n 'No such file to load'
actionview/test/actionpack/abstract/helper_test.rb:112: assert_equal "No such file to load -- very_invalid_file_name.rb", e.message
activesupport/lib/active_support/dependencies.rb:245: def require_dependency(file_name, message = "No such file to load -- %s.rb")
activesupport/lib/active_support/dependencies.rb:333: def depend_on(file_name, message = "No such file to load -- %s.rb")
```
-rw-r--r-- | actionview/test/actionpack/abstract/helper_test.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/actionview/test/actionpack/abstract/helper_test.rb b/actionview/test/actionpack/abstract/helper_test.rb index 5a2f0839e5..83237518d7 100644 --- a/actionview/test/actionpack/abstract/helper_test.rb +++ b/actionview/test/actionpack/abstract/helper_test.rb @@ -109,7 +109,7 @@ module AbstractController class InvalidHelpersTest < ActiveSupport::TestCase def test_controller_raise_error_about_real_require_problem e = assert_raise(LoadError) { AbstractInvalidHelpers.helper(:invalid_require) } - assert_equal "No such file to load -- very_invalid_file_name", e.message + assert_equal "No such file to load -- very_invalid_file_name.rb", e.message end def test_controller_raise_error_about_missing_helper diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 0146401abe..e125b657f2 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -242,7 +242,7 @@ module ActiveSupport #:nodoc: # resolution deterministic for constants with the same relative name in # different namespaces whose evaluation would depend on load order # otherwise. - def require_dependency(file_name, message = "No such file to load -- %s") + def require_dependency(file_name, message = "No such file to load -- %s.rb") file_name = file_name.to_path if file_name.respond_to?(:to_path) unless file_name.is_a?(String) raise ArgumentError, "the file name must either be a String or implement #to_path -- you passed #{file_name.inspect}" |