summaryrefslogtreecommitdiffstats
path: root/test/unit/mailer_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-02-24 03:19:00 +0000
committerGo MAEDA <maeda@farend.jp>2020-02-24 03:19:00 +0000
commit6095186e975bad3a1c0a71f778a2b46b618f934d (patch)
treec2fd8d313524bd93321be7d853961f6e96d9eec6 /test/unit/mailer_test.rb
parent3c45dfaad766f16fb082e68c8d4c8d6370b2fd47 (diff)
downloadredmine-6095186e975bad3a1c0a71f778a2b46b618f934d.tar.gz
redmine-6095186e975bad3a1c0a71f778a2b46b618f934d.zip
Include attachments in news post notifications (#33002).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@19528 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/mailer_test.rb')
-rw-r--r--test/unit/mailer_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index 6e7fc84a7..ace7d6ff9 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -613,14 +613,27 @@ class MailerTest < ActiveSupport::TestCase
end
def test_news_added_should_notify_project_news_watchers
+ set_tmp_attachments_directory
user1 = User.generate!
user2 = User.generate!
news = News.find(1)
news.project.enabled_module('news').add_watcher(user1)
+ attachment = Attachment.generate!(
+ :container => news,
+ :file => uploaded_test_file('testfile.txt', 'text/plain')
+ )
Mailer.deliver_news_added(news)
assert_include user1.mail, recipients
assert_not_include user2.mail, recipients
+ assert_select_email do
+ # link to the attachments download
+ assert_select 'fieldset.attachments' do
+ assert_select 'a[href=?]',
+ "http://localhost:3000/attachments/download/#{attachment.id}/testfile.txt",
+ :text => 'testfile.txt'
+ end
+ end
end
def test_wiki_content_added