order_notifier_test.rb 956 B

12345678910111213141516171819202122232425262728
  1. #---
  2. # Excerpted from "Agile Web Development with Rails",
  3. # published by The Pragmatic Bookshelf.
  4. # Copyrights apply to this code. It may not be used to create training material,
  5. # courses, books, articles, and the like. Contact us if you are in doubt.
  6. # We make no guarantees that this code is fit for any purpose.
  7. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  8. #---
  9. require 'test_helper'
  10. class OrderNotifierTest < ActionMailer::TestCase
  11. test "received" do
  12. mail = OrderNotifier.received
  13. assert_equal "Received", mail.subject
  14. assert_equal ["to@example.org"], mail.to
  15. assert_equal ["from@example.com"], mail.from
  16. assert_match "Hi", mail.body.encoded
  17. end
  18. test "shipped" do
  19. mail = OrderNotifier.shipped
  20. assert_equal "Shipped", mail.subject
  21. assert_equal ["to@example.org"], mail.to
  22. assert_equal ["from@example.com"], mail.from
  23. assert_match "Hi", mail.body.encoded
  24. end
  25. end