1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00

Make session language consistent

This commit is contained in:
Daniel Barber 2018-01-28 19:43:08 -05:00
parent 1299d4f5e5
commit ddcb204758
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
5 changed files with 15 additions and 15 deletions

View File

@ -18,7 +18,7 @@ defmodule ChessWeb.SessionController do
{:ok, user} ->
conn
|> Guardian.Plug.sign_in(user)
|> put_flash(:info, "You are signed in")
|> put_flash(:info, "You are logged in")
|> redirect(to: game_path(conn, :index))
{:error, _error} ->
changeset = User.changeset(%User{})

View File

@ -1,4 +1,4 @@
<h2>Sign in</h2>
<h2>Log in</h2>
<%= form_for @changeset, session_path(@conn, :create), [class: "create-session"], fn f -> %>
<%= if @changeset.action do %>
@ -16,6 +16,6 @@
</div>
</div>
<div class="form-group">
<%= submit "Sign in", class: "btn btn-primary" %>
<%= submit "Log in", class: "btn btn-primary" %>
</div>
<% end %>

View File

@ -1,8 +1,8 @@
defmodule Chess.SessionControllerTest do
use ChessWeb.ConnCase
test "shows sign in form", %{conn: conn} do
test "shows log in form", %{conn: conn} do
conn = get conn, session_path(conn, :new)
assert html_response(conn, 200) =~ "Sign in"
assert html_response(conn, 200) =~ "Log in"
end
end

View File

@ -41,7 +41,7 @@ defmodule Chess.GamesTest do
|> visit("/session/new")
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|> fill_in(text_field("Password"), with: "ilovezelda")
|> click(button("Sign in"))
|> click(button("Log in"))
end
defp create_user() do

View File

@ -5,7 +5,7 @@ defmodule Chess.SessionTest do
import Wallaby.Query, only: [text_field: 1, link: 1, button: 1]
test "user cannot sign in with incorrect username", %{session: session} do
test "user cannot log in with incorrect username", %{session: session} do
create_user()
session
@ -13,12 +13,12 @@ defmodule Chess.SessionTest do
|> click(link("Log in"))
|> fill_in(text_field("Username"), with: "link@example.com")
|> fill_in(text_field("Password"), with: "ilovezelda")
|> click(button("Sign in"))
|> click(button("Log in"))
assert session |> has_text?("Bad username or password")
end
test "user cannot sign in with incorrect password", %{session: session} do
test "user cannot log in with incorrect password", %{session: session} do
create_user()
session
@ -26,12 +26,12 @@ defmodule Chess.SessionTest do
|> click(link("Log in"))
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|> fill_in(text_field("Password"), with: "calamityganon")
|> click(button("Sign in"))
|> click(button("Log in"))
assert session |> has_text?("Bad username or password")
end
test "user can sign in with correct details", %{session: session} do
test "user can log in with correct details", %{session: session} do
create_user()
session
@ -39,14 +39,14 @@ defmodule Chess.SessionTest do
|> click(link("Log in"))
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|> fill_in(text_field("Password"), with: "ilovezelda")
|> click(button("Sign in"))
|> click(button("Log in"))
assert session |> has_text?("You are signed in")
assert session |> has_text?("You are logged in")
assert session |> has_text?("Listing games")
assert session |> has_text?("link@hyrule.kingdom")
end
test "user can sign out", %{session: session} do
test "user can log out", %{session: session} do
create_user()
session
@ -54,7 +54,7 @@ defmodule Chess.SessionTest do
|> click(link("Log in"))
|> fill_in(text_field("Username"), with: "link@hyrule.kingdom")
|> fill_in(text_field("Password"), with: "ilovezelda")
|> click(button("Sign in"))
|> click(button("Log in"))
session
|> visit("/")