Skip to content
Browse files

Make the Action Mailer related tests pass

  • Loading branch information...
1 parent e9f6805 commit a88273651569a4acf5a1993d5f9736ba582e8057 Rafael Mendonça França committed
View
43 test/action_mailer/base_test.rb
@@ -1,3 +1,46 @@
+require 'minitest/autorun'
+require 'action_mailer'
+
+FIXTURE_LOAD_PATH = File.expand_path('fixtures', File.dirname(__FILE__))
+ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
+
+class MockSMTP
+ def self.deliveries
+ @@deliveries
+ end
+
+ def initialize
+ @@deliveries = []
+ end
+
+ def sendmail(mail, from, to)
+ @@deliveries << [mail, from, to]
+ end
+
+ def start(*args)
+ yield self
+ end
+end
+
+class Net::SMTP
+ def self.new(*args)
+ MockSMTP.new
+ end
+end
+
+class BaseMailer < ActionMailer::Base
+ self.mailer_name = "base_mailer"
+
+ default :to => 'system@test.lindsaar.net',
+ :from => 'jose@test.plataformatec.com',
+ :reply_to => 'mikel@test.lindsaar.net'
+
+ def welcome(hash = {})
+ headers['X-SPAM'] = "Not SPAM"
+ mail({:subject => "The first email on new API!"}.merge!(hash))
+ end
+end
+
class BaseTest < ActiveSupport::TestCase
class MyObserver
def self.delivered_email(mail)
View
0 test/action_mailer/fixtures/base_mailer/welcome.html
No changes.

0 comments on commit a882736

Please sign in to comment.
Something went wrong with that request. Please try again.