padrino-mailer 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/padrino-mailer.rb +0 -1
- data/test/fixtures/padrino_app/app.rb +0 -1
- data/test/helper.rb +4 -1
- data/test/test_email.rb +8 -9
- data/test/test_message.rb +9 -10
- data/test/test_padrino_mailer.rb +16 -16
- data/test/test_part.rb +12 -13
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7baba7ff644a9a815ff9fe791dd28d86e2c8d9f5
|
4
|
+
data.tar.gz: a799cb637729c620af35252046e24d8665ea9787
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d16e68bd5e2e890f40cbd177ae11e1780e99e5fcf54fa0c0b400431f0b8ee8d8289377290e75ee37a2d1e8fd7cb464e350a0120a1ee5c08360966b30cc94091e
|
7
|
+
data.tar.gz: 89eeea40ee3abd0c12c5dfb89dfcba7925f8dc3f6acfa0184393f7eda91dee82eccceeba0b4801be9f7eb2cb2d4c7ef2c0e57f8035ee52e0818a7f7a3ac81339
|
data/lib/padrino-mailer.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -2,10 +2,13 @@ ENV['RACK_ENV'] = 'test'
|
|
2
2
|
PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
|
3
3
|
|
4
4
|
require File.expand_path('../../../load_paths', __FILE__)
|
5
|
-
require
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'minitest/pride'
|
6
7
|
require 'rack/test'
|
7
8
|
require 'padrino-core'
|
8
9
|
require 'padrino-helpers'
|
10
|
+
require 'mail'
|
11
|
+
require 'padrino-mailer/ext'
|
9
12
|
require 'padrino-mailer'
|
10
13
|
|
11
14
|
class MiniTest::Spec
|
data/test/test_email.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
2
|
|
3
3
|
describe "Email" do
|
4
|
-
|
5
|
-
|
6
|
-
should 'send a basic inline email' do
|
4
|
+
describe 'the mailer in an app' do
|
5
|
+
it 'should send a basic inline email' do
|
7
6
|
mock_app do
|
8
7
|
register Padrino::Mailer
|
9
8
|
get "/" do
|
@@ -25,7 +24,7 @@ describe "Email" do
|
|
25
24
|
assert_equal 'Body', email.body.to_s
|
26
25
|
end
|
27
26
|
|
28
|
-
should
|
27
|
+
it 'should send a basic inline from hash' do
|
29
28
|
mock_app do
|
30
29
|
register Padrino::Mailer
|
31
30
|
get "/" do
|
@@ -47,7 +46,7 @@ describe "Email" do
|
|
47
46
|
assert_equal 'Body', email.body.to_s
|
48
47
|
end
|
49
48
|
|
50
|
-
should
|
49
|
+
it 'should send an basic email with body template' do
|
51
50
|
mock_app do
|
52
51
|
register Padrino::Mailer
|
53
52
|
get "/" do
|
@@ -70,7 +69,7 @@ describe "Email" do
|
|
70
69
|
assert_equal 'This is a body of text from a template with interpolated <i> and non-interpolated tags<br/>', email.body.to_s.chomp
|
71
70
|
end
|
72
71
|
|
73
|
-
should
|
72
|
+
it 'should send emails with scoped mailer defaults' do
|
74
73
|
mock_app do
|
75
74
|
register Padrino::Mailer
|
76
75
|
set :views, File.dirname(__FILE__) + '/fixtures/views'
|
@@ -95,7 +94,7 @@ describe "Email" do
|
|
95
94
|
assert_equal 'This is a foo message in mailers/alternate dir', email.body.to_s.chomp
|
96
95
|
end
|
97
96
|
|
98
|
-
should
|
97
|
+
it 'should send emails with app mailer defaults' do
|
99
98
|
mock_app do
|
100
99
|
register Padrino::Mailer
|
101
100
|
set :delivery_method, :test
|
@@ -119,7 +118,7 @@ describe "Email" do
|
|
119
118
|
assert_equal 'This is a foo message in mailers/alternate dir', email.body.to_s.chomp
|
120
119
|
end
|
121
120
|
|
122
|
-
should
|
121
|
+
it 'should send emails without layout' do
|
123
122
|
mock_app do
|
124
123
|
register Padrino::Mailer
|
125
124
|
set :views, File.dirname(__FILE__) + '/fixtures/views'
|
@@ -145,7 +144,7 @@ describe "Email" do
|
|
145
144
|
assert_match /TestMailer/, email.delivery_method.to_s
|
146
145
|
end
|
147
146
|
|
148
|
-
should
|
147
|
+
it 'should raise an error if there are two messages with the same name' do
|
149
148
|
assert_raises RuntimeError do
|
150
149
|
mock_app do
|
151
150
|
register Padrino::Mailer
|
data/test/test_message.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
2
|
|
3
3
|
describe "Message" do
|
4
|
-
|
5
|
-
|
6
|
-
should "accept headers and body" do
|
4
|
+
describe 'the message' do
|
5
|
+
it 'should accept headers and body' do
|
7
6
|
message = Mail::Message.new do
|
8
7
|
from 'padrino@me.com'
|
9
8
|
to 'padrino@you.com'
|
@@ -17,7 +16,7 @@ describe "Message" do
|
|
17
16
|
assert_equal 'This is a body of text', message.body.to_s.chomp
|
18
17
|
end
|
19
18
|
|
20
|
-
should
|
19
|
+
it 'should raise an error if template was not found' do
|
21
20
|
assert_raises Padrino::Rendering::TemplateNotFound do
|
22
21
|
Mail::Message.new do
|
23
22
|
from 'padrino@me.com'
|
@@ -28,7 +27,7 @@ describe "Message" do
|
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
31
|
-
should
|
30
|
+
it 'should use locals' do
|
32
31
|
message = Mail::Message.new do
|
33
32
|
from 'padrino@me.com'
|
34
33
|
to 'padrino@you.com'
|
@@ -43,7 +42,7 @@ describe "Message" do
|
|
43
42
|
assert_equal 'Im Foo!', message.body.to_s.chomp
|
44
43
|
end
|
45
44
|
|
46
|
-
should
|
45
|
+
it 'should use views paths' do
|
47
46
|
message = Mail::Message.new do
|
48
47
|
views File.dirname(__FILE__) + '/fixtures/views/mailers'
|
49
48
|
from 'padrino@me.com'
|
@@ -58,7 +57,7 @@ describe "Message" do
|
|
58
57
|
assert_equal 'This is a bar message in mailers dir', message.body.to_s.chomp
|
59
58
|
end
|
60
59
|
|
61
|
-
should
|
60
|
+
it 'should use views and mailers paths' do
|
62
61
|
message = Mail::Message.new do
|
63
62
|
views File.dirname(__FILE__) + '/fixtures/views/mailers'
|
64
63
|
from 'padrino@me.com'
|
@@ -73,7 +72,7 @@ describe "Message" do
|
|
73
72
|
assert_equal 'This is a foo message in mailers/alternate dir', message.body.to_s.chomp
|
74
73
|
end
|
75
74
|
|
76
|
-
should
|
75
|
+
it 'should use layouts' do
|
77
76
|
message = Mail::Message.new do
|
78
77
|
views File.dirname(__FILE__) + '/fixtures/views/mailers'
|
79
78
|
from 'padrino@me.com'
|
@@ -88,7 +87,7 @@ describe "Message" do
|
|
88
87
|
assert_equal 'Layout Sample This is a foo message in mailers/sample dir', message.body.to_s.strip
|
89
88
|
end
|
90
89
|
|
91
|
-
should
|
90
|
+
it 'should use i18n' do
|
92
91
|
I18n.locale = :en
|
93
92
|
|
94
93
|
message = Mail::Message.new do
|
@@ -120,7 +119,7 @@ describe "Message" do
|
|
120
119
|
assert_equal 'Salve Mondo', message.body.to_s.chomp
|
121
120
|
end
|
122
121
|
|
123
|
-
should
|
122
|
+
it 'should auto lookup template for the given content_type' do
|
124
123
|
message = Mail::Message.new do
|
125
124
|
views File.dirname(__FILE__) + '/fixtures/views/mailers'
|
126
125
|
from 'padrino@me.com'
|
data/test/test_padrino_mailer.rb
CHANGED
@@ -3,11 +3,10 @@ require File.expand_path(File.dirname(__FILE__) + '/fixtures/sinatra_app/app')
|
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + '/fixtures/padrino_app/app')
|
4
4
|
|
5
5
|
describe "PadrinoMailer" do
|
6
|
+
describe 'for mail delivery in sample Sinatra application' do
|
7
|
+
before { @app = SinatraApp }
|
6
8
|
|
7
|
-
|
8
|
-
setup { @app = SinatraApp }
|
9
|
-
|
10
|
-
should "be able to deliver inline emails using the email helper" do
|
9
|
+
it 'should be able to deliver inline emails using the email helper' do
|
11
10
|
post '/deliver/inline'
|
12
11
|
assert_equal 'mail delivered', body
|
13
12
|
assert_email_sent(:to => 'john@apple.com',
|
@@ -17,7 +16,7 @@ describe "PadrinoMailer" do
|
|
17
16
|
:delivery_method => @app.delivery_method)
|
18
17
|
end
|
19
18
|
|
20
|
-
should
|
19
|
+
it 'should be able to deliver plain text emails' do
|
21
20
|
post '/deliver/plain'
|
22
21
|
assert_equal 'mail delivered', body
|
23
22
|
assert_email_sent(:to => 'john@fake.com',
|
@@ -27,7 +26,7 @@ describe "PadrinoMailer" do
|
|
27
26
|
:body => "Happy Birthday Joey!\nYou are turning 21")
|
28
27
|
end
|
29
28
|
|
30
|
-
should
|
29
|
+
it 'should be able to deliver emails with custom view' do
|
31
30
|
post '/deliver/custom'
|
32
31
|
assert_equal 'mail delivered', body
|
33
32
|
assert_email_sent(:template => 'mailers/sample/foo_message',
|
@@ -38,7 +37,7 @@ describe "PadrinoMailer" do
|
|
38
37
|
:body => 'Hello to Bobby')
|
39
38
|
end
|
40
39
|
|
41
|
-
should
|
40
|
+
it 'should be able to deliver html emails' do
|
42
41
|
post '/deliver/html'
|
43
42
|
assert_equal 'mail delivered', body
|
44
43
|
assert_email_sent(:to => 'julie@fake.com',
|
@@ -49,7 +48,7 @@ describe "PadrinoMailer" do
|
|
49
48
|
:body => "<p>Yay Joey & Charlotte!</p>\n<p>You have been married 16 years</p>")
|
50
49
|
end
|
51
50
|
|
52
|
-
should
|
51
|
+
it 'should be able to deliver a basic email using app settings' do
|
53
52
|
@app.email(:to => 'john@apple.com', :from => 'joe@smith.com',
|
54
53
|
:subject => 'Test Email', :body => 'Test Body',
|
55
54
|
:via => :test)
|
@@ -59,10 +58,10 @@ describe "PadrinoMailer" do
|
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
62
|
-
|
63
|
-
|
61
|
+
describe 'for mail delivery in sample Padrino application' do
|
62
|
+
before { @app = PadrinoApp }
|
64
63
|
|
65
|
-
should
|
64
|
+
it 'should be able to deliver inline emails using the email helper' do
|
66
65
|
post '/deliver/inline'
|
67
66
|
assert_equal 'mail delivered', body
|
68
67
|
assert_email_sent(:to => 'john@apple.com', :from => 'joe@smith.com',
|
@@ -70,7 +69,7 @@ describe "PadrinoMailer" do
|
|
70
69
|
:body => 'Test Body')
|
71
70
|
end
|
72
71
|
|
73
|
-
should
|
72
|
+
it 'should be able to deliver plain text emails' do
|
74
73
|
post '/deliver/plain'
|
75
74
|
assert_equal 'mail delivered', body
|
76
75
|
assert_email_sent(:to => 'john@fake.com', :from => 'noreply@birthday.com',
|
@@ -78,7 +77,7 @@ describe "PadrinoMailer" do
|
|
78
77
|
:body => "Happy Birthday Joey!\nYou are turning 21")
|
79
78
|
end
|
80
79
|
|
81
|
-
should
|
80
|
+
it 'should be able to deliver emails with custom view' do
|
82
81
|
post '/deliver/custom'
|
83
82
|
assert_equal 'mail delivered', body
|
84
83
|
assert_email_sent(:template => 'mailers/sample/foo_message', :to => 'john@fake.com',
|
@@ -86,7 +85,7 @@ describe "PadrinoMailer" do
|
|
86
85
|
:subject => 'Welcome Message!', :body => 'Hello to Bobby')
|
87
86
|
end
|
88
87
|
|
89
|
-
should
|
88
|
+
it 'should be able to deliver html emails' do
|
90
89
|
post '/deliver/html'
|
91
90
|
assert_equal 'mail delivered', body
|
92
91
|
assert_email_sent(:to => 'julie@fake.com', :from => 'noreply@anniversary.com',
|
@@ -94,7 +93,7 @@ describe "PadrinoMailer" do
|
|
94
93
|
:subject => 'Happy anniversary!', :body => "<p>Yay Joey & Charlotte!</p>\n<p>You have been married 16 years</p>")
|
95
94
|
end
|
96
95
|
|
97
|
-
should
|
96
|
+
it 'should be able to deliver a basic email using app settings' do
|
98
97
|
@app.email(:to => 'john@apple.com', :from => 'joe@smith.com',
|
99
98
|
:subject => 'Test Email', :body => 'Test Body',
|
100
99
|
:via => :test)
|
@@ -103,7 +102,8 @@ describe "PadrinoMailer" do
|
|
103
102
|
:delivery_method => @app.delivery_method)
|
104
103
|
end
|
105
104
|
|
106
|
-
|
105
|
+
it 'should be able to deliver a basic email using Padrino::Helpers' do
|
106
|
+
skip #FIXME
|
107
107
|
post '/deliver/helper'
|
108
108
|
assert_equal 'mail delivered', body
|
109
109
|
assert_email_sent(:to => 'jim@fake.com', :from => 'noreply@custom.com',
|
data/test/test_part.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
2
|
|
3
3
|
describe "Part" do
|
4
|
-
|
5
|
-
|
6
|
-
should "use correctly parts" do
|
4
|
+
describe "the part" do
|
5
|
+
it 'should use correctly parts' do
|
7
6
|
message = Mail::Message.new do
|
8
7
|
views File.dirname(__FILE__) + '/fixtures/views/mailers'
|
9
8
|
to 'padrino@test.lindsaar.net'
|
@@ -23,8 +22,8 @@ describe "Part" do
|
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
|
-
|
27
|
-
|
25
|
+
refute_nil message.html_part
|
26
|
+
refute_nil message.text_part
|
28
27
|
assert_equal 4, message.parts.length
|
29
28
|
assert_equal :plain, message.parts[0].content_type
|
30
29
|
assert_equal 'plain text', message.parts[0].body.decoded
|
@@ -34,7 +33,7 @@ describe "Part" do
|
|
34
33
|
assert_equal 'other', message.parts[2].body.decoded
|
35
34
|
end
|
36
35
|
|
37
|
-
should
|
36
|
+
it 'should works with multipart templates' do
|
38
37
|
message = Mail::Message.new do
|
39
38
|
views File.dirname(__FILE__) + '/fixtures/views/mailers'
|
40
39
|
to 'padrino@test.lindsaar.net'
|
@@ -50,8 +49,8 @@ describe "Part" do
|
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
53
|
-
|
54
|
-
|
52
|
+
refute_nil message.html_part
|
53
|
+
refute_nil message.text_part
|
55
54
|
assert_equal 2, message.parts.length
|
56
55
|
assert_equal :plain, message.parts[0].content_type
|
57
56
|
assert_equal 'plain text', message.parts[0].body.decoded.chomp
|
@@ -59,7 +58,7 @@ describe "Part" do
|
|
59
58
|
assert_equal 'text html', message.parts[1].body.decoded.chomp
|
60
59
|
end
|
61
60
|
|
62
|
-
should
|
61
|
+
it 'should works with less explict multipart templates' do
|
63
62
|
message = Mail::Message.new do
|
64
63
|
views File.dirname(__FILE__) + '/fixtures/views/mailers'
|
65
64
|
to 'padrino@test.lindsaar.net'
|
@@ -70,8 +69,8 @@ describe "Part" do
|
|
70
69
|
html_part { render('multipart/basic.html') }
|
71
70
|
end
|
72
71
|
|
73
|
-
|
74
|
-
|
72
|
+
refute_nil message.html_part
|
73
|
+
refute_nil message.text_part
|
75
74
|
assert_equal 2, message.parts.length
|
76
75
|
assert_equal :plain, message.parts[0].content_type
|
77
76
|
assert_equal 'plain text', message.parts[0].body.decoded.chomp
|
@@ -79,7 +78,7 @@ describe "Part" do
|
|
79
78
|
assert_equal 'text html', message.parts[1].body.decoded.chomp
|
80
79
|
end
|
81
80
|
|
82
|
-
should
|
81
|
+
it 'should works with provides' do
|
83
82
|
message = Mail::Message.new do
|
84
83
|
views File.dirname(__FILE__) + '/fixtures/views/mailers'
|
85
84
|
to 'padrino@test.lindsaar.net'
|
@@ -97,7 +96,7 @@ describe "Part" do
|
|
97
96
|
assert_equal 'text html', message.parts[1].body.decoded.chomp
|
98
97
|
end
|
99
98
|
|
100
|
-
# should
|
99
|
+
# it 'should provide a way to instantiate a new part as you go down' do
|
101
100
|
# message = Mail::Message.new do
|
102
101
|
# to 'padrino@test.lindsaar.net'
|
103
102
|
# subject "nested multipart"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: padrino-core
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.12.
|
22
|
+
version: 0.12.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.12.
|
29
|
+
version: 0.12.1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: mail
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|