From 95b565231a22770e9a17646e2c49e54a9c5aa3a3 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Wed, 15 Aug 2018 14:46:32 -0400 Subject: [PATCH] Adjust email and test for subject --- lib/chess/emails.ex | 10 +++++----- test/chess_web/controllers/game_controller_test.exs | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/chess/emails.ex b/lib/chess/emails.ex index 372eb62..1c3395f 100644 --- a/lib/chess/emails.ex +++ b/lib/chess/emails.ex @@ -6,12 +6,12 @@ defmodule Chess.Emails do def new_game_email(conn, game) do new_email() |> to(game.opponent) - |> from("games@64squares.club") - |> subject("New chess game created!") + |> from({"64squares", "games@64squares.club"}) + |> subject( + "[64squares] #{game.user.name} has invited you to play a game of chess." + ) |> text_body(""" - #{game.user.name} has invited you to play a game of chess. - - #{ChessWeb.Router.Helpers.game_url(conn, :show, game)} + Game link: #{ChessWeb.Router.Helpers.game_url(conn, :show, game)} """) end end diff --git a/test/chess_web/controllers/game_controller_test.exs b/test/chess_web/controllers/game_controller_test.exs index aae03ac..3f34283 100644 --- a/test/chess_web/controllers/game_controller_test.exs +++ b/test/chess_web/controllers/game_controller_test.exs @@ -45,7 +45,8 @@ defmodule ChessWeb.GameControllerTest do |> post(game_path(conn, :create), game: attrs) assert_email_delivered_with( - to: [{opponent.name, opponent.email}] + to: [{opponent.name, opponent.email}], + subject: "[64squares] #{user.name} has invited you to play a game of chess." ) end