maildown 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maildown/ext/action_mailer.rb +16 -1
- data/lib/maildown/version.rb +1 -1
- data/lib/maildown.rb +9 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/mailers/user_no_layout_mailer.rb +11 -0
- data/test/dummy/app/mailers/user_with_layout_mailer.rb +11 -0
- data/test/dummy/app/views/layouts/mail_layout.html.erb +1 -0
- data/test/dummy/app/views/layouts/mail_layout.text.erb +1 -0
- data/test/dummy/app/views/user_no_layout_mailer/welcome.md.erb +1 -0
- data/test/dummy/app/views/user_with_layout_mailer/welcome.md.erb +1 -0
- data/test/dummy/config/environments/development.rb +2 -2
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +2815 -0
- data/test/dummy/test/mailers/previews/user_no_layout_mailer_preview.rb +4 -0
- data/test/dummy/test/mailers/previews/user_with_layout_mailer_preview.rb +4 -0
- data/test/dummy/test/mailers/user_no_layout_mailer_test.rb +7 -0
- data/test/dummy/test/mailers/user_with_layout_mailer_test.rb +7 -0
- data/test/integration/layouts_test.rb +35 -0
- metadata +28 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class LayoutsTest < ActionMailer::TestCase
|
4
|
+
|
5
|
+
def test_no_layout
|
6
|
+
email = UserNoLayoutMailer.welcome.deliver_now
|
7
|
+
assert !ActionMailer::Base.deliveries.empty?
|
8
|
+
# Test the body of the sent email contains what we expect it to
|
9
|
+
assert_equal ["foo@example.com"], email.to
|
10
|
+
assert_equal "hello world", email.subject
|
11
|
+
|
12
|
+
body_contents = /<h2 id="welcome">Welcome!<\/h2>/
|
13
|
+
assert_match body_contents, email.html_part.body.to_s
|
14
|
+
|
15
|
+
body_contents = /## Welcome!/
|
16
|
+
assert_match body_contents, email.text_part.body.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_layout_renders_fine
|
20
|
+
Maildown.enable_layouts = true
|
21
|
+
email = UserWithLayoutMailer.welcome.deliver_now
|
22
|
+
assert !ActionMailer::Base.deliveries.empty?
|
23
|
+
# Test the body of the sent email contains what we expect it to
|
24
|
+
assert_equal ["foo@example.com"], email.to
|
25
|
+
assert_equal "hello world", email.subject
|
26
|
+
|
27
|
+
body_contents = /HTML<h2 id="welcome">Welcome!<\/h2>/
|
28
|
+
assert_match body_contents, email.html_part.body.to_s
|
29
|
+
|
30
|
+
body_contents = /TEXT## Welcome!/
|
31
|
+
assert_match body_contents, email.text_part.body.to_s
|
32
|
+
ensure
|
33
|
+
Maildown.enable_layouts = false
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maildown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- schneems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -102,7 +102,14 @@ files:
|
|
102
102
|
- test/dummy/app/assets/stylesheets/application.css
|
103
103
|
- test/dummy/app/controllers/application_controller.rb
|
104
104
|
- test/dummy/app/helpers/application_helper.rb
|
105
|
+
- test/dummy/app/mailers/application_mailer.rb
|
106
|
+
- test/dummy/app/mailers/user_no_layout_mailer.rb
|
107
|
+
- test/dummy/app/mailers/user_with_layout_mailer.rb
|
105
108
|
- test/dummy/app/views/layouts/application.html.erb
|
109
|
+
- test/dummy/app/views/layouts/mail_layout.html.erb
|
110
|
+
- test/dummy/app/views/layouts/mail_layout.text.erb
|
111
|
+
- test/dummy/app/views/user_no_layout_mailer/welcome.md.erb
|
112
|
+
- test/dummy/app/views/user_with_layout_mailer/welcome.md.erb
|
106
113
|
- test/dummy/bin/bundle
|
107
114
|
- test/dummy/bin/rails
|
108
115
|
- test/dummy/bin/rake
|
@@ -123,11 +130,17 @@ files:
|
|
123
130
|
- test/dummy/config/initializers/wrap_parameters.rb
|
124
131
|
- test/dummy/config/locales/en.yml
|
125
132
|
- test/dummy/config/routes.rb
|
133
|
+
- test/dummy/log/development.log
|
126
134
|
- test/dummy/log/test.log
|
127
135
|
- test/dummy/public/404.html
|
128
136
|
- test/dummy/public/422.html
|
129
137
|
- test/dummy/public/500.html
|
130
138
|
- test/dummy/public/favicon.ico
|
139
|
+
- test/dummy/test/mailers/previews/user_no_layout_mailer_preview.rb
|
140
|
+
- test/dummy/test/mailers/previews/user_with_layout_mailer_preview.rb
|
141
|
+
- test/dummy/test/mailers/user_no_layout_mailer_test.rb
|
142
|
+
- test/dummy/test/mailers/user_with_layout_mailer_test.rb
|
143
|
+
- test/integration/layouts_test.rb
|
131
144
|
- test/test_helper.rb
|
132
145
|
- test/unit/ext_action_mailer_test.rb
|
133
146
|
- test/unit/maildown_test.rb
|
@@ -160,11 +173,22 @@ test_files:
|
|
160
173
|
- test/unit/ext_action_mailer_test.rb
|
161
174
|
- test/unit/maildown_test.rb
|
162
175
|
- test/unit/markdown_engine_test.rb
|
176
|
+
- test/dummy/app/mailers/user_with_layout_mailer.rb
|
177
|
+
- test/dummy/app/mailers/user_no_layout_mailer.rb
|
178
|
+
- test/dummy/app/mailers/application_mailer.rb
|
163
179
|
- test/dummy/app/controllers/application_controller.rb
|
180
|
+
- test/dummy/app/views/user_with_layout_mailer/welcome.md.erb
|
181
|
+
- test/dummy/app/views/user_no_layout_mailer/welcome.md.erb
|
182
|
+
- test/dummy/app/views/layouts/mail_layout.html.erb
|
183
|
+
- test/dummy/app/views/layouts/mail_layout.text.erb
|
164
184
|
- test/dummy/app/views/layouts/application.html.erb
|
165
185
|
- test/dummy/app/assets/javascripts/application.js
|
166
186
|
- test/dummy/app/assets/stylesheets/application.css
|
167
187
|
- test/dummy/app/helpers/application_helper.rb
|
188
|
+
- test/dummy/test/mailers/user_with_layout_mailer_test.rb
|
189
|
+
- test/dummy/test/mailers/previews/user_no_layout_mailer_preview.rb
|
190
|
+
- test/dummy/test/mailers/previews/user_with_layout_mailer_preview.rb
|
191
|
+
- test/dummy/test/mailers/user_no_layout_mailer_test.rb
|
168
192
|
- test/dummy/bin/rake
|
169
193
|
- test/dummy/bin/bundle
|
170
194
|
- test/dummy/bin/rails
|
@@ -191,5 +215,7 @@ test_files:
|
|
191
215
|
- test/dummy/public/500.html
|
192
216
|
- test/dummy/public/404.html
|
193
217
|
- test/dummy/log/test.log
|
218
|
+
- test/dummy/log/development.log
|
194
219
|
- test/dummy/README.rdoc
|
220
|
+
- test/integration/layouts_test.rb
|
195
221
|
- test/test_helper.rb
|