Project

General

Profile

Feature #31225 » 24941_set_time_zone_to_utc.patch

Go MAEDA, 2019-05-22 06:49

View differences:

test/unit/mailer_test.rb
620 620
  end
621 621

  
622 622
  def test_reminders
623
    users(:users_003).pref.update_attribute :time_zone, 'UTC' # dlopper
623 624
    Mailer.reminders(:days => 42)
624 625
    assert_equal 1, ActionMailer::Base.deliveries.size
625 626
    mail = last_email
......
639 640
    with_settings :default_language => 'fr' do
640 641
      user = User.find(3)
641 642
      user.update_attribute :language, ''
643
      user.pref.update_attribute :time_zone, 'UTC'
642 644
      Mailer.reminders(:days => 42)
643 645
      assert_equal 1, ActionMailer::Base.deliveries.size
644 646
      mail = last_email
......
665 667
  end
666 668

  
667 669
  def test_reminders_for_users
670
    users(:users_003).pref.update_attribute :time_zone, 'UTC' # dlopper
668 671
    Mailer.reminders(:days => 42, :users => ['5'])
669 672
    assert_equal 0, ActionMailer::Base.deliveries.size # No mail for dlopper
670 673
    Mailer.reminders(:days => 42, :users => ['3'])
......
677 680
  def test_reminder_should_include_issues_assigned_to_groups
678 681
    with_settings :default_language => 'en', :issue_group_assignment => '1' do
679 682
      group = Group.generate!
680
      user_dlopper = User.find(3)
681 683
      Member.create!(:project_id => 1, :principal => group, :role_ids => [1])
682
      group.users << User.find(2)
683
      group.users << user_dlopper
684
      [users(:users_002), users(:users_003)].each do |user| # jsmith, dlopper
685
        group.users << user
686
        user.pref.update_attribute :time_zone, 'UTC'
687
      end
684 688

  
685 689
      Issue.update_all(:assigned_to_id => nil)
686 690
      due_date = 10.days.from_now
687
      Issue.update(1, :due_date => due_date, :assigned_to_id => user_dlopper.id)
691
      Issue.update(1, :due_date => due_date, :assigned_to_id => 3)
688 692
      Issue.update(2, :due_date => due_date, :assigned_to_id => group.id)
689 693
      Issue.create!(:project_id => 1, :tracker_id => 1, :status_id => 1,
690 694
                      :subject => 'Assigned to group', :assigned_to => group,
......
737 741

  
738 742
  def test_reminders_should_sort_issues_by_due_date
739 743
    user = User.find(2)
744
    user.pref.update_attribute :time_zone, 'UTC'
740 745
    Issue.generate!(:assigned_to => user, :due_date => 2.days.from_now, :subject => 'quux')
741 746
    Issue.generate!(:assigned_to => user, :due_date => 0.days.from_now, :subject => 'baz')
742 747
    Issue.generate!(:assigned_to => user, :due_date => 1.days.from_now, :subject => 'qux')
(4-4/4)