LeapYear: Adding MockTime to output

master
Rob Emery 2015-01-02 10:45:04 +00:00
parent dbb5b62de9
commit a392454551
1 changed files with 21 additions and 1 deletions

View File

@ -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();