diff options
author | José Valim and Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-20 23:46:59 +1100 |
---|---|---|
committer | José Valim and Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-20 23:46:59 +1100 |
commit | c34cfcc29f705c95c2218889cbec1898e008335d (patch) | |
tree | 1dd2381d4828645f072f636e81d6a87b37f13256 /actionmailer/test | |
parent | 10c509fbfa70758ece26e8876d1c5c28f659f2f0 (diff) | |
download | rails-c34cfcc29f705c95c2218889cbec1898e008335d.tar.gz rails-c34cfcc29f705c95c2218889cbec1898e008335d.tar.bz2 rails-c34cfcc29f705c95c2218889cbec1898e008335d.zip |
Created mail method for new API
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/base_test.rb | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index dc1fbc07be..83d51274f0 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -1,3 +1,6 @@ +# encoding: utf-8 +require 'abstract_unit' + # class Notifier < ActionMailer::Base # delivers_from 'notifications@example.com' # @@ -30,10 +33,45 @@ # end # end # -# Notifier.welcome(user) # => returns a Mail object +# mail = Notifier.welcome(user) # => returns a Mail object +# mail.deliver +# # Notifier.welcome(user).deliver # => creates and sends the Mail in one step -class BaseTest < ActionMailer::Base +class BaseTest < Test::Unit::TestCase + class TestMailer < ActionMailer::Base + def welcome(hash = {}) + hash = {:to => 'mikel@test.lindsaar.net', :from => 'jose@test.plataformatec.com', + :subject => 'The first email on new API!'}.merge!(hash) + mail(hash) + end + end + + def test_the_method_call_to_mail_does_not_raise_error + assert_nothing_raised { TestMailer.deliver_welcome } + end + + def test_should_set_the_headers_of_the_mail_message + email = TestMailer.deliver_welcome + assert_equal(email.to, ['mikel@test.lindsaar.net']) + assert_equal(email.from, ['jose@test.plataformatec.com']) + assert_equal(email.subject, 'The first email on new API!') + end + + def test_calling_mail_should_pass_the_header_hash_to_the_new_mail_object + + end + + def test_it_should_guard_against_old_api_if_mail_method_called + + end + + # def test_that_class_defaults_are_set_on_instantiation + # pending + # end + # + # def test_should_set_the_subject_from_i18n + # pending + # end - -end +end
\ No newline at end of file |