From a392454551dc4f4decca0471ea4fa3d0f5b4e694 Mon Sep 17 00:00:00 2001 From: Rob Emery Date: Fri, 2 Jan 2015 10:45:04 +0000 Subject: [PATCH] LeapYear: Adding MockTime to output --- t/LeapYear.t | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/t/LeapYear.t b/t/LeapYear.t index f299c3020..3702c579e 100644 --- a/t/LeapYear.t +++ b/t/LeapYear.t @@ -2,11 +2,14 @@ use strict; use warnings; + +use Test::MockTime qw( :all ); use Test::More; use DDG::Test::Goodie; zci answer_type => 'leap_year'; zci is_cached => 1; + ddg_goodie_test( [qw( DDG::Goodie::LeapYear @@ -19,4 +22,21 @@ ddg_goodie_test( 'when were the last 50 leap years' => test_zci('The last 50 leap years were 2012 CE, 2008 CE, 2004 CE, 2000 CE, 1996 CE, 1992 CE, 1988 CE, 1984 CE, 1980 CE, 1976 CE, 1972 CE, 1968 CE, 1964 CE, 1960 CE, 1956 CE, 1952 CE, 1948 CE, 1944 CE, 1940 CE, 1936 CE, 1932 CE, 1928 CE, 1924 CE, 1920 CE, 1916 CE, 1912 CE, 1908 CE, 1904 CE, 1896 CE, 1892 CE, 1888 CE, 1884 CE, 1880 CE, 1876 CE, 1872 CE, 1868 CE, 1864 CE, 1860 CE, 1856 CE, 1852 CE, 1848 CE, 1844 CE, 1840 CE, 1836 CE, 1832 CE, 1828 CE, 1824 CE, 1820 CE, 1816 CE, 1812 CE, 1808 CE'), ); -done_testing(); +set_fixed_time("2014-12-01T00:00:00"); +ddg_goodie_test( + [qw( + DDG::Goodie::LeapYear + )], + 'is it a leap year?' => test_zci('2014 is a leap year') +); +restore_time(); +set_fixed_time("2015-01-01T00:00:00"); +ddg_goodie_test( + [qw( + DDG::Goodie::LeapYear + )], + 'is it a leap year?' => test_zci('2015 is not a leap year') +); +restore_time(); + +done_testing(); \ No newline at end of file