Fix pod typo (RT #47434)
[catagits/Catalyst-Plugin-Scheduler.git] / t / 09long.t
CommitLineData
f9d8e3cf 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
7use lib "$FindBin::Bin/lib";
8use Test::More;
9
10plan skip_all
11 => 'set TEST_LONG to enable this test. It takes about 1 minute to run.'
12 unless $ENV{TEST_LONG};
13
14plan tests => 6;
15use Catalyst::Test 'TestApp';
16
17TestApp->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
31sleep 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}