Skip to content

assert_error_sent is not passing tests with 404 given a 404 #1577

@elbow-jason

Description

@elbow-jason

Apologies if the offending code/macro/function does not belong to this repo. This happened inside my phoenix project so I figured it belonged here.

Environment

  • Elixir version (elixir -v): Elixir 1.2.2
  • Phoenix version (mix deps): phoenix 1.1.4
  • NodeJS version (node -v): v5.5.0
  • NPM version (npm -v): 3.5.3
  • Operating system: {:unix, :darwin} - OSX Yosemite 10.10.5 (14F27)

Expected behavior

In a newly generated test the following test should pass without incident:

test "does not show resource and instead throw error when id is nonexistent", %{conn: conn} do
  assert_error_sent 404, fn ->
    get conn, user_path(conn, :show, -1)
  end
end

Actual behavior

  1) test does not show resource and instead throw error when id is nonexistent (MyApp.UserControllerTest)
     test/controllers/user_controller_test.exs:45
     expected error to be sent as 404 status, but response sent 404 without error
     stacktrace:
       (phoenix) lib/phoenix/test/conn_test.ex:531: Phoenix.ConnTest.assert_error_sent/2
       test/controllers/user_controller_test.exs:46

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions