diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 19:44:39 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 19:44:39 -0300 |
commit | 734d97d292b4f04c13f03625e07f2888e88b0649 (patch) | |
tree | 941f9ab3764da181497c36264fb74a7a598fb844 /activesupport | |
parent | 48deeab90acd9f8f609fa461205a793c52f11ed2 (diff) | |
download | rails-734d97d292b4f04c13f03625e07f2888e88b0649.tar.gz rails-734d97d292b4f04c13f03625e07f2888e88b0649.tar.bz2 rails-734d97d292b4f04c13f03625e07f2888e88b0649.zip |
Deprecate `MissingSourceFile` in favor of `LoadError`.
`MissingSourceFile` was just an alias to `LoadError` and was not
being raised inside the framework.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 7 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/load_error.rb | 4 | ||||
-rw-r--r-- | activesupport/test/core_ext/load_error_test.rb | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 709e497a6d..3606d7e572 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,10 @@ +* Deprecate `MissingSourceFile` in favor of `LoadError`. + + `MissingSourceFile` was just an alias to `LoadError` and was not being + raised inside the framework. + + *Rafael Mendonça França* + * Add support for error dispatcher classes in `ActiveSupport::Rescuable`. Now it acts closer to Ruby's rescue. diff --git a/activesupport/lib/active_support/core_ext/load_error.rb b/activesupport/lib/active_support/core_ext/load_error.rb index 768b980f21..d9fb392752 100644 --- a/activesupport/lib/active_support/core_ext/load_error.rb +++ b/activesupport/lib/active_support/core_ext/load_error.rb @@ -1,3 +1,5 @@ +require 'active_support/deprecation/proxy_wrappers' + class LoadError REGEXPS = [ /^no such file to load -- (.+)$/i, @@ -25,4 +27,4 @@ class LoadError end end -MissingSourceFile = LoadError +MissingSourceFile = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('MissingSourceFile', 'LoadError') diff --git a/activesupport/test/core_ext/load_error_test.rb b/activesupport/test/core_ext/load_error_test.rb index 66c39b143c..b2a75a2bcc 100644 --- a/activesupport/test/core_ext/load_error_test.rb +++ b/activesupport/test/core_ext/load_error_test.rb @@ -1,6 +1,15 @@ require 'abstract_unit' require 'active_support/core_ext/load_error' + +class TestMissingSourceFile < ActiveSupport::TestCase + def test_it_is_deprecated + assert_deprecated do + MissingSourceFile.new + end + end +end + class TestLoadError < ActiveSupport::TestCase def test_with_require assert_raise(LoadError) { require 'no_this_file_don\'t_exist' } |