Skip to content

Commit

Permalink
Fixed mail generator using hard coded ConfirmationMail name
Browse files Browse the repository at this point in the history
Fixes #530. Also updated tests to use a different wording, just to be sure :)
  • Loading branch information
mpscholten committed Nov 5, 2020
1 parent a810be1 commit 8ed5dc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion IHP/IDE/CodeGen/MailGenerator.hs
Expand Up @@ -66,7 +66,7 @@ buildPlan' schema config =
<> "\n"
<> "instance BuildMail " <> nameWithSuffix <> " where\n"
<> " subject = \"Subject\"\n"
<> " to ConfirmationMail { .. } = Address { addressName = Just \"Firstname Lastname\", addressEmail = \"fname.lname@example.com\" }\n"
<> " to " <> nameWithSuffix <> " { .. } = Address { addressName = Just \"Firstname Lastname\", addressEmail = \"fname.lname@example.com\" }\n"
<> " from = \"hi@example.com\"\n"
<> " html " <> nameWithSuffix <> " { .. } = [hsx|\n"
<> " Hello World\n"
Expand Down
8 changes: 4 additions & 4 deletions Test/IDE/CodeGeneration/MailGenerator.hs
Expand Up @@ -32,8 +32,8 @@ tests = do
, constraints = []
}
]
it "should build a mail with name \"ConfirmationMail\"" do
let mailName = "ConfirmationMail"
it "should build a mail with name \"PurchaseConfirmationMail\"" do
let mailName = "PurchaseConfirmationMail"
let rawControllerName = "Users"
let controllerName = tableNameToControllerName rawControllerName
let modelName = tableNameToModelName rawControllerName
Expand All @@ -43,6 +43,6 @@ tests = do

builtPlan `shouldBe` [
EnsureDirectory {directory = "Web/Mail/Users"}
, CreateFile {filePath = "Web/Mail/Users/Confirmation.hs", fileContent = "module Web.Mail.Users.Confirmation where\nimport Web.View.Prelude\nimport IHP.MailPrelude\n\ndata ConfirmationMail = ConfirmationMail { user :: User }\n\ninstance BuildMail ConfirmationMail where\n subject = \"Subject\"\n to ConfirmationMail { .. } = Address { addressName = Just \"Firstname Lastname\", addressEmail = \"fname.lname@example.com\" }\n from = \"hi@example.com\"\n html ConfirmationMail { .. } = [hsx|\n Hello World\n |]\n"}
, AddImport {filePath = "Web/Controller/Users.hs", fileContent = "import Web.Mail.Users.Confirmation"}
, CreateFile {filePath = "Web/Mail/Users/PurchaseConfirmation.hs", fileContent = "module Web.Mail.Users.PurchaseConfirmation where\nimport Web.View.Prelude\nimport IHP.MailPrelude\n\ndata PurchaseConfirmationMail = PurchaseConfirmationMail { user :: User }\n\ninstance BuildMail PurchaseConfirmationMail where\n subject = \"Subject\"\n to PurchaseConfirmationMail { .. } = Address { addressName = Just \"Firstname Lastname\", addressEmail = \"fname.lname@example.com\" }\n from = \"hi@example.com\"\n html PurchaseConfirmationMail { .. } = [hsx|\n Hello World\n |]\n"}
, AddImport {filePath = "Web/Controller/Users.hs", fileContent = "import Web.Mail.Users.PurchaseConfirmation"}
]

0 comments on commit 8ed5dc5

Please sign in to comment.