mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-27 11:16:10 +01:00
Guard against the case days stale can be negative
This commit is contained in:
parent
d699359648
commit
053e3fc8d6
2 changed files with 16 additions and 1 deletions
|
|
@ -14,6 +14,10 @@ class StalenessTest < Test::Unit::TestCase
|
|||
@now ||= Time.utc(2013, 2, 28, 0, 0, 0)
|
||||
end
|
||||
|
||||
def after_now
|
||||
@after_now ||= Time.utc(2013, 3, 1, 0, 0, 0)
|
||||
end
|
||||
|
||||
def day16
|
||||
@day16 ||= Time.utc(2013, 2, 12, 0, 0, 0)
|
||||
end
|
||||
|
|
@ -36,6 +40,11 @@ class StalenessTest < Test::Unit::TestCase
|
|||
assert_equal 0, Staleness.days_stale(todo, @current_user)
|
||||
end
|
||||
|
||||
def test_created_at_after_current_time_is_not_stale
|
||||
todo = FakeTask.new(nil, false, after_now)
|
||||
assert_equal 0, Staleness.days_stale(todo, @current_user)
|
||||
end
|
||||
|
||||
def test_young_item_is_not_stale
|
||||
todo = FakeTask.new(nil, false, now)
|
||||
assert_equal 0, Staleness.days_stale(todo, @current_user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue