diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2014-01-01 00:12:28 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-04-07 17:50:04 +0100 |
commit | 397252f4463fb787753d99ea57e8a1385fa31a1e (patch) | |
tree | fcea734c86fad4ed0523fc85a11d7d2d1c23cb68 /t | |
parent | b0170c4be0c2c3befcbe0159d4e218db5e0e37a8 (diff) |
Mock a date for dashboard tests
Fixes #365 (how appropriate) by mocking datetime to allow the
dashboard test's assumptions (that we're not so near beginning
of year that a report from X days ago isn't still in same year)
to hold.
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/dashboard.t | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t index 9a6d3e0f9..a87232e9b 100644 --- a/t/app/controller/dashboard.t +++ b/t/app/controller/dashboard.t @@ -1,6 +1,7 @@ use strict; use warnings; use Test::More; +use Test::MockTime ':all'; use FixMyStreet::TestMech; use Web::Scraper; @@ -24,6 +25,9 @@ my $p_user = FixMyStreet::App->model('DB::User')->find_or_create( { email => 'p_user@example.com' } ); +# Dashboard tests assume we are not too early in year, to allow reporting +# within same year, as a convenience. +set_absolute_time('2014-03-01T12:00:00'); FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], MAPIT_URL => 'http://mapit.mysociety.org/', @@ -610,7 +614,7 @@ FixMyStreet::override_config { is scalar @lines, 6, '1 (header) + 5 (reports) = 6 lines'; }; }; - +restore_time; sub make_problem { my $args = shift; |