-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show real LoadError on helpers require #10642
Conversation
|
||
class InvalidHelpersTest < ActiveSupport::TestCase | ||
def test_controller_raise_error_about_real_require_problem | ||
assert_raise(LoadError, "No such file to load -- very_invalid_file_name") do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this really verify the error message? As far as I know this only verifies the type of exception see the minitest source
to verify the message you can use:
e = assert_raise(LoadError) {}
assert_equal "No such file to load -- very_invalid_file_name", e.message
I added a few comments, can you also add a short CHANGELOG entry? |
@LTe ping, are you still on this PR? |
@senny yes, I will create update soon :) |
@senny updated |
@LTe it does no longer apply, can you push a rebased version? |
@@ -1,3 +1,7 @@ | |||
* Fix an issue where rails raise exception about missing helper where is should throw `LoadError`. When helper file exists and only loaded file from this helper does not exist rails should throw LoadError instead of MissingHelperError. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you wrap this line to 80 chars?
@senny rebased and updated |
When helper try to require missing file rails will throw exception about missing helper. # app/helpers/my_helper.rb require 'missing' module MyHelper end And when we try do load helper class ApplicationController helper :my end Rails will throw exception. This is wrong because there is a helper file. Missing helper file helpers/my_helper.rb Now when helper try to require non-existed file rails will throw proper exception. No such file to load -- missing
@LTe thanks for your contribution 💛 |
Show real LoadError on helpers require
Show real LoadError on helpers require Conflicts: actionpack/CHANGELOG.md Closes #12055.
When helper try to require missing file rails will throw exception about
missing helper.
And when we try do load helper
Rails will throw exception. This is wrong because there is a helper file.
Now when helper try to require non-existed file rails will throw proper exception.