Revert breaking commits

This reverts the following commits:
319d4b00cd
403cc1015e
37485013a0
d08ffb3806
This commit is contained in:
Dan Rice 2015-04-14 23:28:18 -04:00
parent 55e28d90a9
commit 1dbef179a7
8 changed files with 81 additions and 301 deletions

View file

@ -8,7 +8,7 @@ module RecurringTodos
def setup
super
@admin = users(:admin_user)
end
end
def test_pattern_builds_from_existing_recurring_todo
rt = @admin.recurring_todos.first
@ -121,9 +121,9 @@ module RecurringTodos
def test_determine_start
travel_to Time.zone.local(2013,1,1) do
rt = create_recurring_todo
assert_equal "2013-01-01", rt.send(:determine_start, nil).to_date.to_s(:db), "no previous date, use today"
assert_equal "2013-01-01", rt.send(:determine_start, nil, 1.day).to_date.to_s(:db), "no previous date, use today without offset"
assert_equal "2013-01-02", rt.send(:determine_start, Time.zone.now, 1.day).to_date.to_s(:db), "use previous date and offset"
assert_equal "2013-01-01 00:00:00", rt.send(:determine_start, nil).to_s(:db), "no previous date, use today"
assert_equal "2013-01-01 00:00:00", rt.send(:determine_start, nil, 1.day).to_s(:db), "no previous date, use today without offset"
assert_equal "2013-01-02 00:00:00", rt.send(:determine_start, Time.zone.now, 1.day).to_s(:db), "use previous date and offset"
end
end
@ -131,14 +131,14 @@ module RecurringTodos
rt = create_recurring_todo
# march 2014 has 5 saturdays, the last will return the 5th
assert_equal "2014-03-01", rt.send(:get_xth_day_of_month, 1, 6, 3, 2014).to_date.to_s(:db)
assert_equal "2014-03-22", rt.send(:get_xth_day_of_month, 4, 6, 3, 2014).to_date.to_s(:db)
assert_equal "2014-03-29", rt.send(:get_xth_day_of_month, 5, 6, 3, 2014).to_date.to_s(:db)
assert_equal "2014-03-01 00:00:00", rt.send(:get_xth_day_of_month, 1, 6, 3, 2014).to_s(:db)
assert_equal "2014-03-22 00:00:00", rt.send(:get_xth_day_of_month, 4, 6, 3, 2014).to_s(:db)
assert_equal "2014-03-29 00:00:00", rt.send(:get_xth_day_of_month, 5, 6, 3, 2014).to_s(:db)
# march 2014 has 4 fridays, the last will return the 4th
assert_equal "2014-03-07", rt.send(:get_xth_day_of_month, 1, 5, 3, 2014).to_date.to_s(:db)
assert_equal "2014-03-28", rt.send(:get_xth_day_of_month, 4, 5, 3, 2014).to_date.to_s(:db)
assert_equal "2014-03-28", rt.send(:get_xth_day_of_month, 5, 5, 3, 2014).to_date.to_s(:db)
assert_equal "2014-03-07 00:00:00", rt.send(:get_xth_day_of_month, 1, 5, 3, 2014).to_s(:db)
assert_equal "2014-03-28 00:00:00", rt.send(:get_xth_day_of_month, 4, 5, 3, 2014).to_s(:db)
assert_equal "2014-03-28 00:00:00", rt.send(:get_xth_day_of_month, 5, 5, 3, 2014).to_s(:db)
assert_raise(RuntimeError, "should check on valid weekdays"){ rt.send(:get_xth_day_of_month, 5, 9, 3, 2014) }
assert_raise(RuntimeError, "should check on valid count x"){ rt.send(:get_xth_day_of_month, 6, 5, 3, 2014) }