Project

General

Profile

Feature #33884 » fixed-33884.patch

Yuichi HARADA, 2020-09-03 08:30

View differences:

app/helpers/issues_helper.rb
384 384
        attr_value = (issue.send attribute).to_s
385 385
        next if attr_value.blank?
386 386

  
387
        if attribute == 'due_date'
388
          attr_value << " (#{due_date_distance_in_words(issue.send(attribute))})" unless issue.closed?
389
        end
387 390
        if html
388 391
          items << content_tag('strong', "#{l("field_#{attribute}")}: ") + attr_value
389 392
        else
test/unit/mailer_test.rb
333 333
    end
334 334
  end
335 335

  
336
  def test_deliver_issue_should_be_show_due_date_with_distance_in_words
337
    issue = issues(:issues_001)
338
    journal = issue.journals.last
339

  
340
    # Do show "Due in X days" if the issue is not closed
341
    expect = /^\* Due date: #{issue.due_date} \(Due in 10 days\)\R/
342

  
343
    ActionMailer::Base.deliveries.clear
344
    Mailer.deliver_issue_add(issue)
345
    assert_mail_body_match expect, last_email
346

  
347
    ActionMailer::Base.deliveries.clear
348
    Mailer.deliver_issue_edit(journal)
349
    assert_mail_body_match expect, last_email
350

  
351
    # Don't show "Due in X days" if the issue is closed
352
    issue.update_attribute(:status, IssueStatus.find_by_is_closed(true))
353
    expect = /^\* Due date: #{issue.due_date}\R/
354

  
355
    ActionMailer::Base.deliveries.clear
356
    Mailer.deliver_issue_add(issue)
357
    assert_mail_body_match expect, last_email
358

  
359
    ActionMailer::Base.deliveries.clear
360
    Mailer.deliver_issue_edit(journal)
361
    assert_mail_body_match expect, last_email
362
  end
363

  
336 364
  def test_message_posted_message_id
337 365
    message = Message.find(1)
338 366
    attachment = message.attachments.first
(2-2/2)