-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Replace 'not found' with 'internal server error' in assert_error_sent/2 examples #5481
Replace 'not found' with 'internal server error' in assert_error_sent/2 examples #5481
Conversation
@phoebe100 sorry, I thought, generally speaking, hitting a missing route should result in a 404 and not in |
True, and a running phoenix application will do that. But when testing controllers, you should differentiate:
b) If you want to verify, that some error was raised while processing the route and that it was linked to an expected status code, then use Since requesting unknown routes do not result in (re-)raising an error anymore, |
@phoebe100 I think I get what you are trying to say. What throws me off the the name of the method: |
Actually, it's both. The intention of the function is to assert:
So it's all about asserting error translation. |
@phoebe100 this is just my opinion, but not getting an error raised for a 404 in combination with this method name do cause some confusion. |
5ef7338
to
482b607
Compare
…/2 code examples. Closes phoenixframework#5480
482b607
to
d3b07bc
Compare
@luka-TU Agreed, hence the original reported issue. I think the docs could still use the 404 example, but it should also have a clear note that |
@stefanchrobot the more detailed the docs are - the better, agree. At the same time, maybe the naming of these methods could have been a bit better, borrowing from some other languages like in the example above. |
❤️❤️❤️🐥🔥 |
Replace 'not found' with 'internal server error' in assert_error_sent/2 code examples.
This could reduce confusion since "not found" errors are no re-raised.
Closes #5480