Project

General

Profile

Feature #31225 » 31225_show_days_until_due_date.patch

Yuichi HARADA, 2019-05-17 04:24

View differences:

app/views/mailer/reminder.html.erb
2 2

  
3 3
<ul>
4 4
<% @issues.each do |issue| -%>
5
  <li><%= link_to_issue(issue, :project => true, :only_path => false) %></li>
5
  <li><%= link_to_issue(issue, :project => true, :only_path => false) %> (<%= due_date_distance_in_words(issue.due_date) %>)</li>
6 6
<% end -%>
7 7
</ul>
8 8

  
app/views/mailer/reminder.text.erb
1 1
<%= l(:mail_body_reminder, :count => @issues.size, :days => @days) %>:
2 2

  
3 3
<% @issues.each do |issue| -%>
4
* <%= "#{issue.project} - #{issue.tracker} ##{issue.id}: #{issue.subject}" %>
4
* <%= "#{issue.project} - #{issue.tracker} ##{issue.id}: #{issue.subject} (#{due_date_distance_in_words(issue.due_date)})" %>
5 5
<% end -%>
6 6

  
7 7
<%= l(:label_issue_view_all)%> (<%= l(:label_x_open_issues_abbr, :count => @open_issues_count) %>)
test/unit/mailer_test.rb
624 624
    assert_equal 1, ActionMailer::Base.deliveries.size
625 625
    mail = last_email
626 626
    assert mail.bcc.include?('dlopper@somenet.foo')
627
    assert_mail_body_match 'Bug #3: Error 281 when updating a recipe', mail
627
    assert_mail_body_match 'Bug #3: Error 281 when updating a recipe (5 days late)', mail
628 628
    assert_mail_body_match 'View all issues (2 open)', mail
629 629
    assert_select_email do
630 630
      assert_select 'a[href=?]',
......
643 643
      assert_equal 1, ActionMailer::Base.deliveries.size
644 644
      mail = last_email
645 645
      assert mail.bcc.include?('dlopper@somenet.foo')
646
      assert_mail_body_match 'Bug #3: Error 281 when updating a recipe', mail
646
      assert_mail_body_match 'Bug #3: Error 281 when updating a recipe (En retard de 5 jours)', mail
647 647
      assert_equal "1 demande(s) arrivent à échéance (42)", mail.subject
648 648
    end
649 649
  end
......
671 671
    assert_equal 1, ActionMailer::Base.deliveries.size # No mail for dlopper
672 672
    mail = last_email
673 673
    assert mail.bcc.include?('dlopper@somenet.foo')
674
    assert_mail_body_match 'Bug #3: Error 281 when updating a recipe', mail
674
    assert_mail_body_match 'Bug #3: Error 281 when updating a recipe (5 days late)', mail
675 675
  end
676 676

  
677 677
  def test_reminder_should_include_issues_assigned_to_groups
......
697 697
      assert_equal %w(dlopper@somenet.foo jsmith@somenet.foo), recipients
698 698
      ActionMailer::Base.deliveries.each do |mail|
699 699
        assert_mail_body_match '1 issue(s) that are assigned to you are due in the next 7 days::', mail
700
        assert_mail_body_match 'Assigned to group', mail
700
        assert_mail_body_match 'Assigned to group (Due in 5 days)', mail
701 701
        assert_mail_body_match "View all issues (#{mail.bcc.include?('dlopper@somenet.foo') ? 3 : 2} open)", mail
702 702
      end
703 703
    end
......
748 748
    assert_equal 1, ActionMailer::Base.deliveries.size
749 749
    assert_select_email do
750 750
      assert_select 'li', 5
751
      assert_select 'li:nth-child(1)', /foo/
752
      assert_select 'li:nth-child(2)', /bar/
753
      assert_select 'li:nth-child(3)', /baz/
754
      assert_select 'li:nth-child(4)', /qux/
755
      assert_select 'li:nth-child(5)', /quux/
751
      assert_select 'li:nth-child(1)', /foo \(1 day late\)/
752
      assert_select 'li:nth-child(2)', /bar \(1 day late\)/
753
      assert_select 'li:nth-child(3)', /baz \(Due in 0 days\)/
754
      assert_select 'li:nth-child(4)', /qux \(Due in 1 day\)/
755
      assert_select 'li:nth-child(5)', /quux \(Due in 2 days\)/
756 756
    end
757 757
  end
758 758

  
(1-1/4)