fix #1002. every nth week was off by one week for recurring weekly todos. Thanks Thomas for spotting this.

Updated the wrong test too.
This commit is contained in:
Reinier Balt 2010-05-02 18:16:29 +02:00
parent 8bc3a484b2
commit 5c25e4569e
3 changed files with 13 additions and 9 deletions

View file

@ -124,7 +124,9 @@ class RecurringTodoTest < ActiveSupport::TestCase
due_date = @weekly_every_day.get_due_date(@sunday)
assert_equal @monday, due_date
# saturday is last day in week, so the next date should be sunday + n_weeks
# saturday is last day in week, so the next date should be sunday + n-1 weeks
# n-1 because sunday is already in the next week
@weekly_every_day.every_other1 = 3
due_date = @weekly_every_day.get_due_date(@saturday)
assert_equal @sunday + 2.weeks, due_date
@ -141,6 +143,10 @@ class RecurringTodoTest < ActiveSupport::TestCase
assert_equal @wednesday, due_date
due_date = @weekly_every_day.get_due_date(@wednesday)
assert_equal @tuesday+1.week, due_date
@weekly_every_day.every_day = ' s'
due_date = @weekly_every_day.get_due_date(@sunday)
assert_equal @saturday+1.week, due_date
end
def test_monthly_pattern