mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-17 06:35:28 +01:00
Fix #1045. The tests broke because of this fix cfc6d117b8. This exposed a new corner case that I fixed and created a test for. Also a small refactoring.
This commit is contained in:
parent
9a243b015a
commit
3d75cd2457
3 changed files with 42 additions and 36 deletions
|
|
@ -207,11 +207,27 @@ class RecurringTodoTest < ActiveSupport::TestCase
|
|||
# same month, after second wednesday
|
||||
due_date = @yearly.get_due_date(Time.zone.local(2008,6,12)) # june 7th
|
||||
assert_equal Time.zone.local(2009,6,10), due_date # june 10th
|
||||
|
||||
# test handling of nil
|
||||
end
|
||||
|
||||
def test_next_todo_without_previous_todo
|
||||
# test handling of nil as previous
|
||||
#
|
||||
# start_from is way_back
|
||||
due_date1 = @yearly.get_due_date(nil)
|
||||
due_date2 = @yearly.get_due_date(Time.now.utc + 1.day)
|
||||
assert_equal due_date1, due_date2
|
||||
|
||||
# start_from is in the future
|
||||
@yearly.start_from = Time.now.utc + 1.week
|
||||
due_date1 = @yearly.get_due_date(nil)
|
||||
due_date2 = @yearly.get_due_date(Time.now.utc + 1.day)
|
||||
assert_equal due_date1, due_date2
|
||||
|
||||
# start_from is nil
|
||||
@yearly.start_from = nil
|
||||
due_date1 = @yearly.get_due_date(nil)
|
||||
due_date2 = @yearly.get_due_date(Time.now.utc + 1.day)
|
||||
assert_equal due_date1, due_date2
|
||||
end
|
||||
|
||||
def test_last_sunday_of_march
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue