diff --git a/lib/phoenix/test/conn_test.ex b/lib/phoenix/test/conn_test.ex index d7a08b2456..ffd002a580 100644 --- a/lib/phoenix/test/conn_test.ex +++ b/lib/phoenix/test/conn_test.ex @@ -370,7 +370,7 @@ defmodule Phoenix.ConnTest do if given == status do body else - raise "expected response with status #{given}, got: #{status}, with body:\n#{body}" + raise "expected response with status #{given}, got: #{status}, with body:\n#{inspect(body)}" end end diff --git a/test/phoenix/test/conn_test.exs b/test/phoenix/test/conn_test.exs index d256db7480..2269aaee0e 100644 --- a/test/phoenix/test/conn_test.exs +++ b/test/phoenix/test/conn_test.exs @@ -264,9 +264,14 @@ defmodule Phoenix.Test.ConnTest do end assert_raise RuntimeError, - "expected response with status 200, got: 404, with body:\noops", fn -> + "expected response with status 200, got: 404, with body:\n\"oops\"", fn -> build_conn(:get, "/") |> resp(404, "oops") |> response(200) end + + assert_raise RuntimeError, + "expected response with status 200, got: 404, with body:\n<<192>>", fn -> + build_conn(:get, "/") |> resp(404, <<192>>) |> response(200) + end end test "html_response/2" do @@ -313,7 +318,7 @@ defmodule Phoenix.Test.ConnTest do |> json_response(200) end - assert_raise RuntimeError, ~s(expected response with status 200, got: 400, with body:\n{"error": "oh oh"}), fn -> + assert_raise RuntimeError, ~s(expected response with status 200, got: 400, with body:\n) <> inspect(~s({"error": "oh oh"})), fn -> build_conn(:get, "/") |> put_resp_content_type("application/json") |> resp(400, ~s({"error": "oh oh"}))