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
Fix invalid statement template compile error #42244
Fix invalid statement template compile error #42244
Conversation
@hahmed Weird that this wasn't picked up before, how did you find it? 🤔 |
That's where I found it from, thanks @kamipo, was trying to find a way to write a test, before I moved it to ready for review. Currently there are no tests around the invalid_statement view and a few others. In this case, that could be because where the class originates from i.e. For example I tried to test but could not throw a StatementInvalid error, action pack does not have ActiveRecord dependency, test example:
If you do have ideas on how to test, let me know 👍 (will make the PR ready to review) |
One possible way is to test it in rails/railties/test/application/middleware/exceptions_test.rb Lines 36 to 47 in f95c0b7
|
@hahmed Since you're adding a regression test, could you show us the result before the patch? |
I added a regression to catch any issues with the .html.erb template, so for example if we remove an
To repo
I could not see an existing test for this, but I'm going to take a closer look. I'm also going to add a test to catch regressions in the (moving back to draft and so I can work on adding that other test) |
da8e49f
to
0fc1396
Compare
app.config.consider_all_requests_local = true | ||
app.config.action_dispatch.ignore_accept_header = false | ||
|
||
get "/foo", {}, { "HTTP_ACCEPT" => "text/plain", "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest" } |
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.
Weird, but I was expecting this to work:
get "/foo", headers: { "HTTP_ACCEPT" => "text/plain", "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest" }
0fc1396
to
1be3277
Compare
…rror Fix invalid statement template compile error
…rror Fix invalid statement template compile error
Summary
In the view
actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb
there is a missingend
, causing a compile error with the template.