Skip to content
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

Documentation for assert_error_sent/2 does not match actual behavior #5480

Closed
roelandvanbatenburg opened this issue Jun 1, 2023 · 1 comment · Fixed by #5481
Closed

Documentation for assert_error_sent/2 does not match actual behavior #5480

roelandvanbatenburg opened this issue Jun 1, 2023 · 1 comment · Fixed by #5481

Comments

@roelandvanbatenburg
Copy link

Environment

  • Elixir version (elixir -v): Elixir 1.14.2 (compiled with Erlang/OTP 25)
  • Phoenix version (mix deps): 1.7.3
  • Operating system: macOS 12.6.3

Expected behavior

Test as described in the example for assert_error_sent/2 to be working

Actual behavior

  1) test GET /users/not-found (VerifyAssertErrorSentWeb.ErrorHTMLTest)
     test/verify_assert_error_sent_web/controllers/error_html_test.exs:16
     expected error to be sent as 404 status, but response sent 404 without error
     code: assert_error_sent(:not_found, fn ->
     stacktrace:
       (phoenix 1.7.3) lib/phoenix/test/conn_test.ex:669: Phoenix.ConnTest.assert_error_sent/2
       test/verify_assert_error_sent_web/controllers/error_html_test.exs:17: (test)

Context

This is introduced by #5445, if I revert those changes, my test succeed again. I do not know if RenderErrors.__catch__/5, assert_error_sent/2 or the documentation needs to be changed.

phoebe100 added a commit to phoebe100/phoenix that referenced this issue Jun 1, 2023
@phoebe100
Copy link
Contributor

I think the change in #5445 is correct, so I would say the examples in assert_error_sent/2 should be adjusted to reduce confusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants