PageRenderTime 52ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/plugins/action_mailer_optional_tls/test/tls_test.rb

https://bitbucket.org/systech3/boxyroom
Ruby | 42 lines | 38 code | 3 blank | 1 comment | 0 complexity | 6e4797e5457a30c59a62ded1eb4e845c MD5 | raw file
Possible License(s): JSON, MIT
  1. require "rubygems"
  2. require 'test/unit'
  3. gem "actionpack"
  4. gem "actionmailer"
  5. gem "activesupport"
  6. require "active_support"
  7. require "action_pack"
  8. require "action_mailer"
  9. require "init"
  10. class Emailer < ActionMailer::Base
  11. def email(h)
  12. recipients h[:recipients]
  13. subject h[:subject]
  14. from h[:from]
  15. body h[:body]
  16. content_type "text/plain"
  17. end
  18. end
  19. class TlsTest < Test::Unit::TestCase
  20. # Replace this with your real tests.
  21. def setup
  22. ActionMailer::Base.smtp_settings = {
  23. :address => "smtp.gmail.com",
  24. :port => 587,
  25. :user_name => ENV['EMAIL'],
  26. :password => ENV['PASSWORD'],
  27. :authentication => :plain,
  28. :tls => true
  29. }
  30. end
  31. def test_send_mail
  32. Emailer.deliver_email(
  33. :recipients => ENV["EMAIL"],
  34. :subject => "SMTP/TLS test",
  35. :from => ENV["EMAIL"],
  36. :body => "This email was sent at #{Time.now.inspect}"
  37. )
  38. end
  39. end