aaronrenner / phx_gen_auth

An authentication system generator for Phoenix 1.5 applications.
774 stars 56 forks source link

Improve coverage for user return to #84

Closed josevalim closed 3 years ago

josevalim commented 3 years ago

I accidentally broke the user_return_to implementation and I was not able to find this mistake for a couple weeks, so I suggest adding this controller test to help avoid others accidentally breaking it too:

# user_session_controller_test
test "logs the user in with return to", %{conn: conn, user: user} do
  conn =
    conn
    |> init_test_session(user_return_to: "/foo/bar")
    |> post(Routes.user_session_path(conn, :create), %{
      "user" => %{
        "email" => user.email,
        "password" => valid_user_password(),
        "remember_me" => "true"
      }
    })

  assert redirected_to(conn) == "/foo/bar"
end
josevalim commented 3 years ago

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart: