mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-07 21:22:37 +01:00
Refactor the calculation for staleness
Provide the number of days that the todo was stale instead of a class name to use in the view. We'll use the number of days stale in the helper to determine the class name
This commit is contained in:
parent
8dfbac0fe8
commit
43275e064e
2 changed files with 9 additions and 27 deletions
|
|
@ -40,32 +40,22 @@ class StalenessTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_item_with_due_date_is_not_stale_ever
|
||||
todo = FakeTask.new(day24, false, now)
|
||||
assert_equal "", Staleness.days_stale(todo, @current_user)
|
||||
todo = FakeTask.new(now, false, day24)
|
||||
assert_equal 0, Staleness.days_stale(todo, @current_user)
|
||||
end
|
||||
|
||||
def test_complete_item_is_not_stale
|
||||
todo = FakeTask.new(day16, true, day24)
|
||||
assert_equal "", Staleness.days_stale(todo, @current_user)
|
||||
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 "", Staleness.days_stale(todo, @current_user)
|
||||
assert_equal 0, Staleness.days_stale(todo, @current_user)
|
||||
end
|
||||
|
||||
def test_staleness_level_one
|
||||
def test_todo_staleness_calculation
|
||||
todo = FakeTask.new(nil, false, day8)
|
||||
assert_equal " stale_l1", Staleness.days_stale(todo, @current_user)
|
||||
end
|
||||
|
||||
def test_staleness_level_two
|
||||
todo = FakeTask.new(nil, false, day16)
|
||||
assert_equal " stale_l2", Staleness.days_stale(todo, @current_user)
|
||||
end
|
||||
|
||||
def test_staleness_level_three
|
||||
todo = FakeTask.new(nil, false, day24)
|
||||
assert_equal " stale_l3", Staleness.days_stale(todo, @current_user)
|
||||
assert_equal 8, Staleness.days_stale(todo, @current_user)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue