diff --git a/test/models/recurring_todos/abstract_recurrence_pattern_test.rb b/test/models/recurring_todos/abstract_recurrence_pattern_test.rb index f46d9a40..31601368 100644 --- a/test/models/recurring_todos/abstract_recurrence_pattern_test.rb +++ b/test/models/recurring_todos/abstract_recurrence_pattern_test.rb @@ -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 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" + 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" 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 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) + 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) # march 2014 has 4 fridays, the last will return the 4th - 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_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_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) }