diff options
author | Dave Arter <davea@mysociety.org> | 2017-02-27 13:20:54 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2017-02-27 13:20:54 +0000 |
commit | 2cbbbd09d42d6568ef83b6c0d877d769342040ac (patch) | |
tree | c6bff793a2dd44bc249326fdf8b2c187e20ef4ea /t/app/model/problem.t | |
parent | 36838708a432de937828f6a8ef4aff608654f900 (diff) | |
parent | 587a125c46f229ed23aaf68d3308f6755e2d8299 (diff) |
Merge branch 'issues/forcouncils/98-add-pretty-duration-to-report-list'
Diffstat (limited to 't/app/model/problem.t')
-rw-r--r-- | t/app/model/problem.t | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 52213ed51..b942a5333 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -833,7 +833,6 @@ subtest 'get report time ago in appropriate format' => sub { confirmed => DateTime->now->subtract( years => 2 ) } ); is $problem->time_ago, '2 years', 'problem returns time ago in years'; - }; subtest 'time ago works with other dates' => sub { @@ -845,6 +844,20 @@ subtest 'time ago works with other dates' => sub { is $problem->time_ago('lastupdate'), '4 days', 'problem returns last updated time ago in days'; }; +subtest 'return how many days ago a problem was reported' => sub { + my ($problem) = $mech->create_problems_for_body(1, $body_ids{2651}, 'TITLE'); + $problem->update( { + confirmed => DateTime->now->subtract( weeks => 2 ) + } ); + is $problem->days_ago, 14, 'days_ago returns the amount of days'; + + $problem->update( { + lastupdate => DateTime->now->subtract( days => 4) + } ); + + is $problem->days_ago('lastupdate'), 4, 'days_ago allows other dates to be specified'; +}; + END { $problem->comments->delete if $problem; $problem->delete if $problem; |