Skip to content

Instantly share code, notes, and snippets.

@KronicDeth
Last active August 26, 2015 21:20
Show Gist options
  • Save KronicDeth/5a3d1355e6473808f29e to your computer and use it in GitHub Desktop.
Save KronicDeth/5a3d1355e6473808f29e to your computer and use it in GitHub Desktop.
......
1) test HTTPS GET / (RoutingSecurelyWithPhoenixFramework.PageControllerTest)
test/controllers/page_controller_test.exs:13
** (RuntimeError) expected response with status 200, got: 301
stacktrace:
(phoenix) lib/phoenix/test/conn_test.ex:316: Phoenix.ConnTest.response/2
(phoenix) lib/phoenix/test/conn_test.ex:330: Phoenix.ConnTest.html_response/2
test/controllers/page_controller_test.exs:15
Finished in 0.2 seconds (0.2s on load, 0.01s on tests)
7 tests, 1 failures
Randomized with seed 555566
defmodule RoutingSecurelyWithPhoenixFramework.PageControllerTest do
use RoutingSecurelyWithPhoenixFramework.ConnCase
def https(conn) do
%Plug.Conn{conn | scheme: :https}
end
test "HTTP GET /" do
conn = get conn(), "/"
assert redirected_to(conn, 301) == "https://test.routing-securely-with-phoenix-framework.localhost:4364/"
end
test "HTTPS GET /" do
conn = conn |> https |> get("/")
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment