-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mandrill Merge Vars #219
Mandrill Merge Vars #219
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,44 @@ defmodule Bamboo.MandrillHelperTest do | |
assert email.private.message_params == %{"track_links" => true} | ||
end | ||
|
||
test "put_merge_vars/3 puts a list of merge_vars in private.merge_vars" do | ||
users = [ | ||
%{ | ||
email: "user1@example.com", | ||
full_name: "User 1" | ||
}, | ||
%{ | ||
email: "user2@example.com", | ||
full_name: "User 2" | ||
} | ||
] | ||
|
||
email = new_email | ||
|> MandrillHelper.put_merge_vars(users, fn(user) -> %{ full_name: user.full_name } end) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you indent this two spaces? Either that or put it on the same line and make the function multiline like this: email = MandrillHelper.put_merge_vars email, users, fn(user) ->
%{full_name: user.full_name}
end There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still trying to get used to the code standards x) Fixed. |
||
|
||
assert email.private.message_params == %{"merge_vars" => [ | ||
%{ | ||
rcpt: "user1@example.com", | ||
vars: [ | ||
%{ | ||
"name": "full_name", | ||
"content": "User 1" | ||
} | ||
] | ||
}, | ||
%{ | ||
rcpt: "user2@example.com", | ||
vars: [ | ||
%{ | ||
"name": "full_name", | ||
"content": "User 2" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
end | ||
|
||
test "adds tags to mandrill emails" do | ||
email = new_email |> MandrillHelper.tag("welcome-email") | ||
assert email.private.message_params == %{"tags" => ["welcome-email"]} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about moving the example above the "A convenience function for:"