Skip to content

Commit

Permalink
Update test to have parity with Hello World README example
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingserious committed Jun 28, 2017
1 parent e2d0d47 commit 2663a0a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions test/sendgrid/helpers/mail/test_mail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ def setup
end

def test_hello_world
mail = Mail.new
mail.from = Email.new(email: "[email protected]")
mail.subject = "Hello World from the SendGrid Ruby Library"
personalization = Personalization.new
personalization.add_to(Email.new(email: "[email protected]"))
mail.add_personalization(personalization)
mail.add_content(Content.new(type: "text/plain", value: "some text here"))
mail.add_content(Content.new(type: "text/html", value: "<html><body>some text here</body></html>"))
assert_equal(mail.to_json, JSON.parse('{"content":[{"type":"text/plain","value":"some text here"},{"type":"text/html","value":"<html><body>some text here</body></html>"}],"from":{"email":"[email protected]"},"personalizations":[{"to":[{"email":"[email protected]"}]}],"subject":"Hello World from the SendGrid Ruby Library"}'))
from = Email.new(email: '[email protected]')
to = Email.new(email: '[email protected]')
subject = 'Sending with SendGrid is Fun'
content = Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
mail = Mail.new(from, subject, to, content)

assert_equal(mail.to_json, JSON.parse('{"from":{"email":"[email protected]"}, "subject":"Sending with SendGrid is Fun", "personalizations":[{"to":[{"email":"[email protected]"}]}], "content":[{"type":"text/plain", "value":"and easy to do anywhere, even with Ruby"}]}'))
end

def test_kitchen_sink
Expand Down

0 comments on commit 2663a0a

Please sign in to comment.