padrino-mailer 0.9.10 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/README.rdoc +75 -35
  2. data/Rakefile +4 -52
  3. data/lib/padrino-mailer.rb +16 -8
  4. data/lib/padrino-mailer/base.rb +57 -78
  5. data/lib/padrino-mailer/ext.rb +231 -0
  6. data/lib/padrino-mailer/helpers.rb +125 -0
  7. data/lib/padrino-mailer/mime.rb +42 -0
  8. data/padrino-mailer.gemspec +15 -70
  9. data/test/fixtures/basic.erb +1 -0
  10. data/test/fixtures/layout.erb +1 -0
  11. data/test/fixtures/padrino_app/app.rb +69 -0
  12. data/test/fixtures/{mailer_app/views/demo_mailer → padrino_app/views/mailers/demo}/sample_mail.erb +0 -0
  13. data/test/fixtures/{mailer_app/views/sample_mailer/anniversary_message.erb → padrino_app/views/mailers/sample/anniversary.erb} +0 -0
  14. data/test/fixtures/{mailer_app/views/sample_mailer/birthday_message.erb → padrino_app/views/mailers/sample/birthday.erb} +0 -0
  15. data/test/fixtures/{mailer_app/views/sample_mailer → padrino_app/views/mailers/sample}/foo_message.erb +0 -0
  16. data/test/fixtures/sinatra_app/app.rb +67 -0
  17. data/test/fixtures/sinatra_app/views/mailers/demo/sample_mail.erb +1 -0
  18. data/test/fixtures/sinatra_app/views/mailers/sample/anniversary.erb +2 -0
  19. data/test/fixtures/sinatra_app/views/mailers/sample/birthday.erb +2 -0
  20. data/test/fixtures/sinatra_app/views/mailers/sample/foo_message.erb +1 -0
  21. data/test/fixtures/views/mailers/alternate/foo.erb +1 -0
  22. data/test/fixtures/views/mailers/bar.erb +1 -0
  23. data/test/fixtures/views/mailers/i18n/hello.en.erb +1 -0
  24. data/test/fixtures/views/mailers/i18n/hello.it.erb +1 -0
  25. data/test/fixtures/views/mailers/layouts/sample.erb +1 -0
  26. data/test/fixtures/views/mailers/multipart/basic.html.erb +1 -0
  27. data/test/fixtures/views/mailers/multipart/basic.plain.erb +1 -0
  28. data/test/fixtures/views/mailers/sample/foo.erb +1 -0
  29. data/test/helper.rb +38 -42
  30. data/test/test_email.rb +158 -0
  31. data/test/test_message.rb +153 -0
  32. data/test/test_padrino_mailer.rb +64 -23
  33. data/test/test_part.rb +119 -0
  34. metadata +95 -51
  35. data/lib/padrino-mailer/delivery.rb +0 -110
  36. data/lib/padrino-mailer/mail_object.rb +0 -65
  37. data/test/fixtures/mailer_app/app.rb +0 -64
  38. data/test/test_base.rb +0 -86
  39. data/test/test_mail_object.rb +0 -25
@@ -0,0 +1 @@
1
+ text html
@@ -0,0 +1 @@
1
+ plain text
@@ -0,0 +1 @@
1
+ This is a foo message in mailers/sample dir
data/test/helper.rb CHANGED
@@ -1,51 +1,26 @@
1
- require 'rubygems'
1
+ ENV['PADRINO_ENV'] = 'test'
2
+ PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
3
+
4
+ require File.expand_path('../../../load_paths', __FILE__)
2
5
  require 'test/unit'
3
6
  require 'shoulda'
4
7
  require 'mocha'
5
8
  require 'rack/test'
6
- require 'webrat'
7
-
8
- # We try to load the vendored padrino-core if exist
9
- %w(core).each do |lib|
10
- if File.exist?(File.dirname(__FILE__) + "/../../padrino-#{lib}/lib")
11
- $:.unshift File.dirname(__FILE__) + "/../../padrino-#{lib}/lib"
12
- end
13
- end
14
-
9
+ require 'padrino-core'
15
10
  require 'padrino-mailer'
16
11
 
17
12
  class Test::Unit::TestCase
18
13
  include Rack::Test::Methods
19
- include Webrat::Methods
20
- include Webrat::Matchers
21
14
 
22
- Webrat.configure do |config|
23
- config.mode = :rack
15
+ # Sets up a Sinatra::Base subclass defined with the block
16
+ # given. Used in setup or individual spec methods to establish
17
+ # the application.
18
+ def mock_app(base=Padrino::Application, &block)
19
+ @app = Sinatra.new(base, &block)
24
20
  end
25
21
 
26
- def stop_time_for_test
27
- time = Time.now
28
- Time.stubs(:now).returns(time)
29
- return time
30
- end
31
-
32
- # assert_has_tag(:h1, :content => "yellow") { "<h1>yellow</h1>" }
33
- # In this case, block is the html to evaluate
34
- def assert_has_tag(name, attributes = {}, &block)
35
- html = block && block.call
36
- matcher = HaveSelector.new(name, attributes)
37
- raise "Please specify a block!" if html.blank?
38
- assert matcher.matches?(html), matcher.failure_message
39
- end
40
-
41
- # assert_has_no_tag, tag(:h1, :content => "yellow") { "<h1>green</h1>" }
42
- # In this case, block is the html to evaluate
43
- def assert_has_no_tag(name, attributes = {}, &block)
44
- html = block && block.call
45
- attributes.merge!(:count => 0)
46
- matcher = HaveSelector.new(name, attributes)
47
- raise "Please specify a block!" if html.blank?
48
- assert matcher.matches?(html), matcher.failure_message
22
+ def app
23
+ Rack::Lint.new(@app)
49
24
  end
50
25
 
51
26
  # Silences the output by redirecting to stringIO
@@ -58,17 +33,38 @@ class Test::Unit::TestCase
58
33
  log_buffer.rewind && log_buffer.read
59
34
  end
60
35
 
36
+ def pop_last_delivery
37
+ Mail::TestMailer.deliveries.pop
38
+ end
39
+
40
+ # Asserts that the specified email object was delivered
41
+ def assert_email_sent(mail_attributes, options={})
42
+ mail_message = Mail::TestMailer.deliveries.last
43
+ raise "No mail message has been sent!" unless mail_message.present?
44
+ smtp_settings = options.delete(:smtp) || mail_attributes.delete(:smtp)
45
+ delivery_attributes = mail_attributes
46
+ delivery_attributes = { :to => Array(mail_attributes[:to]), :from => Array(mail_attributes[:from]) }
47
+ delivery_attributes.each_pair do |k, v|
48
+ unless mail_message.method(k).call == v
49
+ raise "Mail failure (#{k}): #{mail_message.attributes.inspect} does not match #{delivery_attributes.inspect}"
50
+ end
51
+ end
52
+ Mail::TestMailer.deliveries.clear
53
+ end
54
+
61
55
  # Asserts that a file matches the pattern
62
56
  def assert_match_in_file(pattern, file)
63
57
  assert File.exist?(file), "File '#{file}' does not exist!"
64
58
  assert_match pattern, File.read(file)
65
59
  end
66
- end
67
60
 
68
- module Webrat
69
- module Logging
70
- def logger # :nodoc:
71
- @logger = nil
61
+ # Delegate other missing methods to response.
62
+ def method_missing(name, *args, &block)
63
+ if response && response.respond_to?(name)
64
+ response.send(name, *args, &block)
65
+ else
66
+ super(name, *args, &block)
72
67
  end
73
68
  end
69
+ alias :response :last_response
74
70
  end
@@ -0,0 +1,158 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ class TestEmail < Test::Unit::TestCase
4
+
5
+ context 'the mailer in a app' do
6
+
7
+ should 'send a basic inline email' do
8
+ mock_app do
9
+ register Padrino::Mailer
10
+ get "/" do
11
+ email do
12
+ from 'padrino@me.com'
13
+ to 'padrino@you.com'
14
+ subject 'Hello there Padrino'
15
+ body 'Body'
16
+ via :test
17
+ end
18
+ end
19
+ end
20
+ get "/"
21
+ assert ok?
22
+ email = pop_last_delivery
23
+ assert_equal ['padrino@me.com'], email.from
24
+ assert_equal ['padrino@you.com'], email.to
25
+ assert_equal 'Hello there Padrino', email.subject
26
+ assert_equal 'Body', email.body.to_s
27
+ end
28
+
29
+ should 'send a basic inline from hash' do
30
+ mock_app do
31
+ register Padrino::Mailer
32
+ get "/" do
33
+ email({
34
+ :from => 'padrino@me.com',
35
+ :to => 'padrino@you.com',
36
+ :subject => 'Hello there Padrino',
37
+ :body => 'Body',
38
+ :via => :test
39
+ })
40
+ end
41
+ end
42
+ get "/"
43
+ assert ok?
44
+ email = pop_last_delivery
45
+ assert_equal ['padrino@me.com'], email.from
46
+ assert_equal ['padrino@you.com'], email.to
47
+ assert_equal 'Hello there Padrino', email.subject
48
+ assert_equal 'Body', email.body.to_s
49
+ end
50
+
51
+ should 'send an basic email with body template' do
52
+ mock_app do
53
+ register Padrino::Mailer
54
+ get "/" do
55
+ email do
56
+ views File.dirname(__FILE__) + '/fixtures'
57
+ from 'padrino@me.com'
58
+ to 'padrino@you.com'
59
+ subject 'Hello there Padrino'
60
+ render :basic
61
+ via :test
62
+ end
63
+ end
64
+ end
65
+ get "/"
66
+ assert ok?
67
+ email = pop_last_delivery
68
+ assert_equal ['padrino@me.com'], email.from
69
+ assert_equal ['padrino@you.com'], email.to
70
+ assert_equal 'Hello there Padrino', email.subject
71
+ assert_equal 'This is a body of text from a template', email.body.to_s
72
+ end
73
+
74
+ should 'send emails with scoped mailer defaults' do
75
+ mock_app do
76
+ register Padrino::Mailer
77
+ set :views, File.dirname(__FILE__) + '/fixtures/views'
78
+ mailer :alternate do
79
+ defaults :from => 'padrino@from.com', :to => 'padrino@to.com'
80
+ email :foo do
81
+ to 'padrino@different.com'
82
+ subject 'Hello there again Padrino'
83
+ via :test
84
+ render 'alternate/foo'
85
+ end
86
+ end
87
+ get("/") { deliver(:alternate, :foo) }
88
+ end
89
+ get "/"
90
+ assert ok?
91
+ email = pop_last_delivery
92
+ assert_equal ['padrino@from.com'], email.from, "should have used default value"
93
+ assert_equal ['padrino@different.com'], email.to, "should have overwritten default value"
94
+ assert_equal 'Hello there again Padrino', email.subject
95
+ assert_equal 'This is a foo message in mailers/alternate dir', email.body.to_s
96
+ end
97
+
98
+ should 'send emails with app mailer defaults' do
99
+ mock_app do
100
+ register Padrino::Mailer
101
+ set :views, File.dirname(__FILE__) + '/fixtures/views'
102
+ set :mailer_defaults, :from => 'padrino@from.com', :to => 'padrino@to.com', :subject => "This is a test"
103
+ mailer :alternate do
104
+ email :foo do
105
+ to 'padrino@different.com'
106
+ via :test
107
+ render 'alternate/foo'
108
+ end
109
+ end
110
+ get("/") { deliver(:alternate, :foo) }
111
+ end
112
+ get "/"
113
+ assert ok?
114
+ email = pop_last_delivery
115
+ assert_equal ['padrino@from.com'], email.from, "should have used default value"
116
+ assert_equal ['padrino@different.com'], email.to, "should have overwritten default value"
117
+ assert_equal 'This is a test', email.subject
118
+ assert_equal 'This is a foo message in mailers/alternate dir', email.body.to_s
119
+ end
120
+
121
+ should 'send emails without layout' do
122
+ mock_app do
123
+ register Padrino::Mailer
124
+ set :views, File.dirname(__FILE__) + '/fixtures/views'
125
+ mailer :alternate do
126
+ email :foo do
127
+ from 'padrino@me.com'
128
+ to 'padrino@you.com'
129
+ subject 'Hello there Padrino'
130
+ via :test
131
+ render 'alternate/foo'
132
+ end
133
+ end
134
+ get("/") { deliver(:alternate, :foo) }
135
+ end
136
+ get "/"
137
+ assert ok?
138
+ email = pop_last_delivery
139
+ assert_equal ['padrino@me.com'], email.from
140
+ assert_equal ['padrino@you.com'], email.to
141
+ assert_equal 'Hello there Padrino', email.subject
142
+ assert_equal 'This is a foo message in mailers/alternate dir', email.body.to_s
143
+ assert_match /TestMailer/, email.delivery_method.to_s
144
+ end
145
+
146
+ should 'raise an error if there are two messages with the same name' do
147
+ assert_raise RuntimeError do
148
+ mock_app do
149
+ register Padrino::Mailer
150
+ mailer :foo do
151
+ email :bar do; end
152
+ email :bar do; end
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,153 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ class TestMessage < Test::Unit::TestCase
4
+
5
+ context 'the message' do
6
+ should "accept headers and body" do
7
+ message = Mail::Message.new do
8
+ from 'padrino@me.com'
9
+ to 'padrino@you.com'
10
+ subject 'Hello there Padrino'
11
+ body 'This is a body of text'
12
+ end
13
+
14
+ assert_equal ['padrino@me.com'], message.from
15
+ assert_equal ['padrino@you.com'], message.to
16
+ assert_equal 'Hello there Padrino', message.subject
17
+ assert_equal 'This is a body of text', message.body.to_s
18
+ end
19
+
20
+ should "raise an error if template was not found" do
21
+ assert_raise Padrino::Rendering::TemplateNotFound do
22
+ Mail::Message.new do
23
+ from 'padrino@me.com'
24
+ to 'padrino@you.com'
25
+ subject 'Hello there Padrino'
26
+ render 'foo/bar'
27
+ end
28
+ end
29
+ end
30
+
31
+ should "use locals" do
32
+ message = Mail::Message.new do
33
+ from 'padrino@me.com'
34
+ to 'padrino@you.com'
35
+ subject 'Hello there Padrino'
36
+ locals :foo => "Im Foo!"
37
+ body erb("<%= foo %>")
38
+ end
39
+
40
+ assert_equal ['padrino@me.com'], message.from
41
+ assert_equal ['padrino@you.com'], message.to
42
+ assert_equal 'Hello there Padrino', message.subject
43
+ assert_equal 'Im Foo!', message.body.to_s
44
+ end
45
+
46
+ should "use views paths" do
47
+ message = Mail::Message.new do
48
+ views File.dirname(__FILE__) + '/fixtures/views/mailers'
49
+ from 'padrino@me.com'
50
+ to 'padrino@you.com'
51
+ subject 'Hello there Padrino'
52
+ render :bar
53
+ end
54
+
55
+ assert_equal ['padrino@me.com'], message.from
56
+ assert_equal ['padrino@you.com'], message.to
57
+ assert_equal 'Hello there Padrino', message.subject
58
+ assert_equal 'This is a bar message in mailers dir', message.body.to_s
59
+ end
60
+
61
+ should "use views and mailers paths" do
62
+ message = Mail::Message.new do
63
+ views File.dirname(__FILE__) + '/fixtures/views/mailers'
64
+ from 'padrino@me.com'
65
+ to 'padrino@you.com'
66
+ subject 'Hello there Padrino'
67
+ render 'alternate/foo'
68
+ end
69
+
70
+ assert_equal ['padrino@me.com'], message.from
71
+ assert_equal ['padrino@you.com'], message.to
72
+ assert_equal 'Hello there Padrino', message.subject
73
+ assert_equal 'This is a foo message in mailers/alternate dir', message.body.to_s
74
+ end
75
+
76
+ should "use layouts" do
77
+ message = Mail::Message.new do
78
+ views File.dirname(__FILE__) + '/fixtures/views/mailers'
79
+ from 'padrino@me.com'
80
+ to 'padrino@you.com'
81
+ subject 'Hello there Padrino'
82
+ render 'sample/foo', :layout => :"layouts/sample"
83
+ end
84
+
85
+ assert_equal ['padrino@me.com'], message.from
86
+ assert_equal ['padrino@you.com'], message.to
87
+ assert_equal 'Hello there Padrino', message.subject
88
+ assert_equal 'Layout Sample This is a foo message in mailers/sample dir', message.body.to_s
89
+ end
90
+
91
+ should "use i18n" do
92
+ I18n.locale = :en
93
+
94
+ message = Mail::Message.new do
95
+ views File.dirname(__FILE__) + '/fixtures/views/mailers'
96
+ from 'padrino@me.com'
97
+ to 'padrino@you.com'
98
+ subject 'Hello there Padrino'
99
+ render 'i18n/hello'
100
+ end
101
+
102
+ assert_equal ['padrino@me.com'], message.from
103
+ assert_equal ['padrino@you.com'], message.to
104
+ assert_equal 'Hello there Padrino', message.subject
105
+ assert_equal 'Hello World', message.body.to_s
106
+
107
+ I18n.locale = :it
108
+
109
+ message = Mail::Message.new do
110
+ views File.dirname(__FILE__) + '/fixtures/views/mailers'
111
+ from 'padrino@me.com'
112
+ to 'padrino@you.com'
113
+ subject 'Hello there Padrino'
114
+ render 'i18n/hello'
115
+ end
116
+
117
+ assert_equal ['padrino@me.com'], message.from
118
+ assert_equal ['padrino@you.com'], message.to
119
+ assert_equal 'Hello there Padrino', message.subject
120
+ assert_equal 'Salve Mondo', message.body.to_s
121
+ end
122
+
123
+ should "auto lookup template for the given content_type" do
124
+ message = Mail::Message.new do
125
+ views File.dirname(__FILE__) + '/fixtures/views/mailers'
126
+ from 'padrino@me.com'
127
+ to 'padrino@you.com'
128
+ subject 'Hello there Padrino'
129
+ content_type 'text/html'
130
+ render 'multipart/basic'
131
+ end
132
+
133
+ assert_equal ['padrino@me.com'], message.from
134
+ assert_equal ['padrino@you.com'], message.to
135
+ assert_equal 'Hello there Padrino', message.subject
136
+ assert_equal 'text html', message.body.to_s
137
+
138
+ message = Mail::Message.new do
139
+ views File.dirname(__FILE__) + '/fixtures/views/mailers'
140
+ from 'padrino@me.com'
141
+ to 'padrino@you.com'
142
+ subject 'Hello there Padrino'
143
+ content_type :plain
144
+ render 'multipart/basic'
145
+ end
146
+
147
+ assert_equal ['padrino@me.com'], message.from
148
+ assert_equal ['padrino@you.com'], message.to
149
+ assert_equal 'Hello there Padrino', message.subject
150
+ assert_equal 'plain text', message.body.to_s
151
+ end
152
+ end
153
+ end
@@ -1,45 +1,86 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/helper')
2
- require File.expand_path(File.dirname(__FILE__) + '/fixtures/mailer_app/app')
2
+ require File.expand_path(File.dirname(__FILE__) + '/fixtures/sinatra_app/app')
3
+ require File.expand_path(File.dirname(__FILE__) + '/fixtures/padrino_app/app')
3
4
 
4
5
  class TestPadrinoMailer < Test::Unit::TestCase
5
- def app
6
- MailerDemo.tap { |app| app.set :environment, :test }
7
- end
8
6
 
9
- context 'for mail delivery in sample application' do
10
- setup {
11
- Padrino::Mailer::Base::views_path << MailerDemo.views
12
- MailerDemo::SampleMailer.smtp_settings = MailerDemo.smtp_settings
13
- }
7
+ context 'for mail delivery in sample sinatra application' do
8
+ setup { @app = SinatraApp }
9
+
10
+ should "be able to deliver inline emails using the email helper" do
11
+ post '/deliver/inline'
12
+ assert_equal 'mail delivered', body
13
+ assert_email_sent(:to => 'john@apple.com', :from => 'joe@smith.com',
14
+ :subject => 'Test Email', :body => 'Test Body', :delivery_method => @app.delivery_method)
15
+ end
14
16
 
15
17
  should 'be able to deliver plain text emails' do
16
- assert_email_sent(:to => 'john@fake.com', :from => 'noreply@birthday.com', :via => :smtp,
18
+ post '/deliver/plain'
19
+ assert_equal 'mail delivered', body
20
+ assert_email_sent(:to => 'john@fake.com', :from => 'noreply@birthday.com', :delivery_method => @app.delivery_method,
17
21
  :subject => "Happy Birthday!", :body => "Happy Birthday Joey!\nYou are turning 21")
18
- visit '/deliver/plain', :post
19
- assert_equal 'mail delivered', last_response.body
20
22
  end
21
23
 
22
24
  should 'be able to deliver emails with custom view' do
23
- assert_email_sent(:template => 'sample_mailer/foo_message', :to => 'john@fake.com',
24
- :from => 'noreply@custom.com', :via => :smtp,
25
+ post '/deliver/custom'
26
+ assert_equal 'mail delivered', body
27
+ assert_email_sent(:template => 'mailers/sample/foo_message', :to => 'john@fake.com',
28
+ :from => 'noreply@custom.com', :delivery_method => @app.delivery_method,
25
29
  :subject => "Welcome Message!", :body => "Hello to Bobby")
26
- visit '/deliver/custom', :post
27
- assert_equal 'mail delivered', last_response.body
28
30
  end
29
31
 
30
32
  should 'be able to deliver html emails' do
33
+ post '/deliver/html'
34
+ assert_equal 'mail delivered', body
31
35
  assert_email_sent(:to => 'julie@fake.com', :from => 'noreply@anniversary.com',
32
- :content_type => 'text/html', :via => :smtp,
36
+ :content_type => 'text/html', :delivery_method => @app.delivery_method,
33
37
  :subject => "Happy anniversary!", :body => "<p>Yay Joey & Charlotte!</p>\n<p>You have been married 16 years</p>")
34
- visit '/deliver/html', :post
35
- assert_equal 'mail delivered', last_response.body
38
+ end
39
+
40
+ should 'be able to deliver a basic email using app settings' do
41
+ @app.email(:to => 'john@apple.com', :from => 'joe@smith.com', :subject => 'Test Email', :body => 'Test Body', :via => :test)
42
+ assert_email_sent(:to => 'john@apple.com', :from => 'joe@smith.com',
43
+ :subject => 'Test Email', :body => 'Test Body', :delivery_method => @app.delivery_method)
36
44
  end
37
45
  end
38
46
 
39
- protected
47
+ context 'for mail delivery in sample padrino application' do
48
+ setup { @app = PadrinoApp }
40
49
 
41
- def assert_email_sent(mail_attributes)
42
- delivery_attributes = mail_attributes.merge(:smtp => MailerDemo.smtp_settings)
43
- Padrino::Mailer::MailObject.any_instance.expects(:send_mail).with(delivery_attributes).once.returns(true)
50
+ should "be able to deliver inline emails using the email helper" do
51
+ post '/deliver/inline'
52
+ assert_equal 'mail delivered', body
53
+ assert_email_sent(:to => 'john@apple.com', :from => 'joe@smith.com', :delivery_method => @app.delivery_method,
54
+ :subject => 'Test Email', :body => 'Test Body')
44
55
  end
56
+
57
+ should 'be able to deliver plain text emails' do
58
+ post '/deliver/plain'
59
+ assert_equal 'mail delivered', body
60
+ assert_email_sent(:to => 'john@fake.com', :from => 'noreply@birthday.com', :delivery_method => @app.delivery_method,
61
+ :subject => "Happy Birthday!", :body => "Happy Birthday Joey!\nYou are turning 21")
62
+ end
63
+
64
+ should 'be able to deliver emails with custom view' do
65
+ post '/deliver/custom'
66
+ assert_equal 'mail delivered', body
67
+ assert_email_sent(:template => 'mailers/sample/foo_message', :to => 'john@fake.com',
68
+ :from => 'noreply@custom.com', :delivery_method => @app.delivery_method,
69
+ :subject => "Welcome Message!", :body => "Hello to Bobby")
70
+ end
71
+
72
+ should 'be able to deliver html emails' do
73
+ post '/deliver/html'
74
+ assert_equal 'mail delivered', body
75
+ assert_email_sent(:to => 'julie@fake.com', :from => 'noreply@anniversary.com',
76
+ :content_type => 'text/html', :delivery_method => @app.delivery_method,
77
+ :subject => "Happy anniversary!", :body => "<p>Yay Joey & Charlotte!</p>\n<p>You have been married 16 years</p>")
78
+ end
79
+
80
+ should 'be able to deliver a basic email using app settings' do
81
+ @app.email(:to => 'john@apple.com', :from => 'joe@smith.com', :subject => 'Test Email', :body => 'Test Body', :via => :test)
82
+ assert_email_sent(:to => 'john@apple.com', :from => 'joe@smith.com',
83
+ :subject => 'Test Email', :body => 'Test Body', :delivery_method => @app.delivery_method)
84
+ end
85
+ end
45
86
  end