File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ def render
51
51
File . open ( filepath , 'w' ) do |f |
52
52
f . write ERB . new ( template ) . result ( binding )
53
53
end
54
+
55
+ mail [ "location_#{ type } " ] = filepath
54
56
end
55
57
56
58
def template
Original file line number Diff line number Diff line change @@ -216,6 +216,23 @@ def mail(options={}, &blk)
216
216
end
217
217
end
218
218
219
+ describe '#render' do
220
+ it 'records the saved email path for plain content type' do
221
+ mail = mail ( :subject => 'test_mail' )
222
+ message = described_class . new ( mail , location : location )
223
+ message . render
224
+ expect ( mail [ 'location_plain' ] . value ) . to end_with ( 'tmp/letter_opener/plain.html' )
225
+ end
226
+
227
+
228
+ it 'records the saved email path for rich content type' do
229
+ mail = mail ( :content_type => 'text/html' , :subject => 'test_mail' )
230
+ message = described_class . new ( mail , location : location )
231
+ message . render
232
+ expect ( mail [ 'location_rich' ] . value ) . to end_with ( 'tmp/letter_opener/rich.html' )
233
+ end
234
+ end
235
+
219
236
describe '.rendered_messages' do
220
237
it 'uses configured default template if options not given' do
221
238
allow ( LetterOpener . configuration ) . to receive ( :location ) { location }
You can’t perform that action at this time.
0 commit comments