mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-25 00:24:07 +01:00
move daily test to daily pattern test
This commit is contained in:
parent
b84adfc172
commit
a9fa955c33
4 changed files with 53 additions and 32 deletions
|
|
@ -6,7 +6,10 @@ module RecurringTodos
|
|||
fixtures :users
|
||||
|
||||
def setup
|
||||
super
|
||||
@admin = users(:admin_user)
|
||||
@every_day = recurring_todos(:call_bill_gates_every_day)
|
||||
@every_workday = recurring_todos(:call_bill_gates_every_workday)
|
||||
end
|
||||
|
||||
def test_daily_attributes
|
||||
|
|
@ -43,6 +46,29 @@ module RecurringTodos
|
|||
assert_equal "every 2 days", @every_day.recurrence_pattern
|
||||
end
|
||||
|
||||
def test_daily_every_day
|
||||
# every_day should return todays date if there was no previous date
|
||||
due_date = @every_day.get_due_date(nil)
|
||||
# use only day-month-year compare, because milisec / secs could be different
|
||||
assert_equal_dmy @today, due_date
|
||||
|
||||
# when the last todo was completed today, the next todo is due tomorrow
|
||||
due_date =@every_day.get_due_date(@today)
|
||||
assert_equal @tomorrow, due_date
|
||||
|
||||
# do something every 14 days
|
||||
@every_day.every_other1=14
|
||||
due_date = @every_day.get_due_date(@today)
|
||||
assert_equal @today+14.days, due_date
|
||||
end
|
||||
|
||||
def test_daily_work_days
|
||||
assert_equal @monday, @every_workday.get_due_date(@friday)
|
||||
assert_equal @monday, @every_workday.get_due_date(@saturday)
|
||||
assert_equal @monday, @every_workday.get_due_date(@sunday)
|
||||
assert_equal @tuesday, @every_workday.get_due_date(@monday)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue