January 2019
Intermediate to advanced
376 pages
8h 49m
English
It’s now time to take these well-tested bits, and integrate them. Fortunately for us, integration is not a concern for this chapter (we care about unit tests), so we can just throw everything together quickly and consider our job done:
| | Erlang code/ResponsibleTesting/erlang/bday/src/bday.erl |
| | -module(bday). |
| | -export([main/1]). |
| | |
| | main([Path]) -> |
| | {ok, Data} = file:read_file(Path), |
| | Handle = bday_employee:from_csv(binary_to_list(Data)), |
| | Query = bday_employee:filter_birthday(Handle, date()), % date = local time |
| | BdaySet = bday_employee:fetch(Query), |
| | Mails = [bday_mail_tpl:full(Employee) || Employee <- BdaySet], |
| | [send_email(To, Topic, Body) || {To, Topic, Body} <- Mails]. |
| | |
| | send_email ... |
Read now
Unlock full access