Last active
August 26, 2015 21:20
-
-
Save KronicDeth/5a3d1355e6473808f29e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
...... | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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