Scheduler: Fixed under warning, added some additional YAML tests
[catagits/Catalyst-Plugin-Scheduler.git] / t / 09long.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin;
7 use lib "$FindBin::Bin/lib";
8 use Test::More;
9
10 plan skip_all 
11     => 'set TEST_LONG to enable this test.  It takes about 1 minute to run.' 
12     unless $ENV{TEST_LONG};
13     
14 plan tests => 6;
15 use Catalyst::Test 'TestApp';
16
17 TestApp->schedule(
18     at    => '* * * * *',
19     event => '/cron/every_minute',
20 );
21
22 # test that the event does not execute when we first start up
23 {
24     ok( my $res = request('http://localhost/'), 'request ok' );
25     is( $res->content, 'default', 'response ok' );
26     is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", undef, 'every_minute did not execute, ok' );
27     unlink "$FindBin::Bin/lib/TestApp/every_minute.log";
28 }
29
30 # wait for a minute
31 sleep 61;
32
33 # test that the event does execute
34 {
35     ok( my $res = request('http://localhost/'), 'request ok' );
36     is( $res->content, 'default', 'response ok' );
37     is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", 1, 'every_minute executed ok' );
38     unlink "$FindBin::Bin/lib/TestApp/every_minute.log";
39 }