summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-11-06 03:13:46 +0000
committerGo MAEDA <maeda@farend.jp>2018-11-06 03:13:46 +0000
commit54cfb7b75ede8736c8bee1a4aa88e098e1df3889 (patch)
treea04250cc2cfe5a2d4d4ffafe9c018330295b1583 /test
parent5dee8589d5ed6d33a75421502197efd55983161a (diff)
downloadredmine-54cfb7b75ede8736c8bee1a4aa88e098e1df3889.tar.gz
redmine-54cfb7b75ede8736c8bee1a4aa88e098e1df3889.zip
Sort issues by due date in email reminders (#29771).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@17624 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/mailer_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index 41e886f5b..da259beea 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -621,6 +621,27 @@ class MailerTest < ActiveSupport::TestCase
end
end
+ def test_reminders_should_sort_issues_by_due_date
+ user = User.find(2)
+ Issue.generate!(:assigned_to => user, :due_date => 2.days.from_now, :subject => 'quux')
+ Issue.generate!(:assigned_to => user, :due_date => 0.days.from_now, :subject => 'baz')
+ Issue.generate!(:assigned_to => user, :due_date => 1.days.from_now, :subject => 'qux')
+ Issue.generate!(:assigned_to => user, :due_date => -1.days.from_now, :subject => 'foo')
+ Issue.generate!(:assigned_to => user, :due_date => -1.days.from_now, :subject => 'bar')
+ ActionMailer::Base.deliveries.clear
+
+ Mailer.reminders(:days => 7, :users => [user.id])
+ assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_select_email do
+ assert_select 'li', 5
+ assert_select 'li:nth-child(1)', /foo/
+ assert_select 'li:nth-child(2)', /bar/
+ assert_select 'li:nth-child(3)', /baz/
+ assert_select 'li:nth-child(4)', /qux/
+ assert_select 'li:nth-child(5)', /quux/
+ end
+ end
+
def test_security_notification
set_language_if_valid User.find(1).language
with_settings :emails_footer => "footer without link" do