Project

General

Profile

Feature #31225 » 31225_fix_test_v2.patch

Yuichi HARADA, 2019-05-22 02:45

View differences:

test/fixtures/issues.yml
14 14
  author_id: 2
15 15
  status_id: 1
16 16
  start_date: <%= 1.day.ago.to_date.to_s(:db) %>
17
  due_date: <%= 10.day.from_now.to_date.to_s(:db) %>
17
  due_date: <%= 10.day.from_now(Time.now).to_date.to_s(:db) %>
18 18
  estimated_hours: 200.0
19 19
  root_id: 1
20 20
  lft: 1
......
57 57
  author_id: 2
58 58
  status_id: 1
59 59
  start_date: <%= 15.day.ago.to_date.to_s(:db) %>
60
  due_date: <%= 5.day.ago.to_date.to_s(:db) %>
60
  due_date: <%= 5.day.ago(Time.now).to_date.to_s(:db) %>
61 61
  estimated_hours: 1.0
62 62
  root_id: 3
63 63
  lft: 1
......
112 112
  author_id: 2
113 113
  status_id: 1
114 114
  start_date: <%= Date.today.to_s(:db) %>
115
  due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
115
  due_date: <%= 1.days.from_now(Time.now).to_date.to_s(:db) %>
116 116
  root_id: 6
117 117
  lft: 1
118 118
  rgt: 2
......
172 172
  author_id: 2
173 173
  status_id: 1
174 174
  start_date: <%= Date.today.to_s(:db) %>
175
  due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
175
  due_date: <%= 1.days.from_now(Time.now).to_date.to_s(:db) %>
176 176
  root_id: 9
177 177
  lft: 1
178 178
  rgt: 2
......
191 191
  author_id: 2
192 192
  status_id: 1
193 193
  start_date: <%= Date.today.to_s(:db) %>
194
  due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
194
  due_date: <%= 1.days.from_now(Time.now).to_date.to_s(:db) %>
195 195
  root_id: 10
196 196
  lft: 1
197 197
  rgt: 2
test/unit/mailer_test.rb
652 652
    with_settings :default_language => 'en' do
653 653
      Issue.create!(:project_id => 1, :tracker_id => 1, :status_id => 5,
654 654
                      :subject => 'Closed issue', :assigned_to_id => 3,
655
                      :due_date => 5.days.from_now,
655
                      :due_date => 5.days.from_now(Time.now).to_date,
656 656
                      :author_id => 2)
657 657
      ActionMailer::Base.deliveries.clear
658 658

  
......
683 683
      group.users << user_dlopper
684 684

  
685 685
      Issue.update_all(:assigned_to_id => nil)
686
      due_date = 10.days.from_now
686
      due_date = 10.days.from_now(Time.now).to_date
687 687
      Issue.update(1, :due_date => due_date, :assigned_to_id => user_dlopper.id)
688 688
      Issue.update(2, :due_date => due_date, :assigned_to_id => group.id)
689 689
      Issue.create!(:project_id => 1, :tracker_id => 1, :status_id => 1,
690 690
                      :subject => 'Assigned to group', :assigned_to => group,
691
                      :due_date => 5.days.from_now,
691
                      :due_date => 5.days.from_now(Time.now).to_date,
692 692
                      :author_id => 2)
693 693
      ActionMailer::Base.deliveries.clear
694 694

  
......
706 706
  def test_reminders_with_version_option
707 707
    with_settings :default_language => 'en' do
708 708
      version = Version.generate!(:name => 'Acme', :project_id => 1)
709
      Issue.generate!(:assigned_to => User.find(2), :due_date => 5.days.from_now)
710
      Issue.generate!(:assigned_to => User.find(3), :due_date => 5.days.from_now, :fixed_version => version)
709
      due_date = 5.days.from_now(Time.now).to_date
710
      Issue.generate!(:assigned_to => User.find(2), :due_date => due_date)
711
      Issue.generate!(:assigned_to => User.find(3), :due_date => due_date, :fixed_version => version)
711 712
      ActionMailer::Base.deliveries.clear
712 713

  
713 714
      Mailer.reminders(:days => 42, :version => 'acme')
......
722 723
      member = Member.create!(:project_id => 2, :principal => user, :role_ids => [1])
723 724
      Issue.create!(:project_id => 2, :tracker_id => 1, :status_id => 1,
724 725
                      :subject => 'Issue dlopper should not see', :assigned_to_id => 3,
725
                      :due_date => 5.days.from_now,
726
                      :due_date => 5.days.from_now(Time.now).to_date,
726 727
                      :author_id => 2)
727 728
      member.destroy
728 729
      ActionMailer::Base.deliveries.clear
......
737 738

  
738 739
  def test_reminders_should_sort_issues_by_due_date
739 740
    user = User.find(2)
740
    Issue.generate!(:assigned_to => user, :due_date => 2.days.from_now, :subject => 'quux')
741
    Issue.generate!(:assigned_to => user, :due_date => 0.days.from_now, :subject => 'baz')
742
    Issue.generate!(:assigned_to => user, :due_date => 1.days.from_now, :subject => 'qux')
743
    Issue.generate!(:assigned_to => user, :due_date => -1.days.from_now, :subject => 'foo')
744
    Issue.generate!(:assigned_to => user, :due_date => -1.days.from_now, :subject => 'bar')
741
    time_now = Time.now
742
    Issue.generate!(:assigned_to => user, :due_date => 2.days.from_now(time_now).to_date, :subject => 'quux')
743
    Issue.generate!(:assigned_to => user, :due_date => 0.days.from_now(time_now).to_date, :subject => 'baz')
744
    Issue.generate!(:assigned_to => user, :due_date => 1.days.from_now(time_now).to_date, :subject => 'qux')
745
    Issue.generate!(:assigned_to => user, :due_date => -1.days.from_now(time_now).to_date, :subject => 'foo')
746
    Issue.generate!(:assigned_to => user, :due_date => -1.days.from_now(time_now).to_date, :subject => 'bar')
745 747
    ActionMailer::Base.deliveries.clear
746 748

  
747 749
    Mailer.reminders(:days => 7, :users => [user.id])
(3-3/4)