diff options
author | Christian Felder (masone) <ema@rh-productions.ch> | 2014-09-19 10:32:08 +0200 |
---|---|---|
committer | Christian Felder (masone) <ema@rh-productions.ch> | 2014-09-22 15:52:48 +0200 |
commit | b37e8482caee6d406ac5933fceb60cd2b74adfb7 (patch) | |
tree | a89307c6ddc50e85982b6fb42f252c6d3055b3aa /actionmailer/test/base_test.rb | |
parent | c2dfc316912e780dfd6113e6ab9668128264f111 (diff) | |
download | rails-b37e8482caee6d406ac5933fceb60cd2b74adfb7.tar.gz rails-b37e8482caee6d406ac5933fceb60cd2b74adfb7.tar.bz2 rails-b37e8482caee6d406ac5933fceb60cd2b74adfb7.zip |
Allow attaching files while the mail view is rendered
Diffstat (limited to 'actionmailer/test/base_test.rb')
-rw-r--r-- | actionmailer/test/base_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index d00f5aea47..dcb6959543 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -259,6 +259,20 @@ class BaseTest < ActiveSupport::TestCase assert_match(/Can't add attachments after `mail` was called./, e.message) end + test "adding inline attachments while rendering mail works" do + class LateInlineAttachmentMailer < ActionMailer::Base + def on_render + mail from: "welcome@example.com", to: "to@example.com" + end + end + + mail = LateInlineAttachmentMailer.on_render + assert_nothing_raised { mail.message } + + assert_equal ["image/jpeg; filename=controller_attachments.jpg", + "image/jpeg; filename=attachments.jpg"], mail.attachments.inline.map {|a| a['Content-Type'].to_s } + end + test "accessing attachments works after mail was called" do class LateAttachmentAccessorMailer < ActionMailer::Base def welcome |