7 use lib "$FindBin::Bin/lib";
8 use Test::More tests => 6;
9 use Catalyst::Test 'TestApp';
11 our $STATE = "$FindBin::Bin/lib/TestApp/scheduler.state";
12 our $BASE = 'Catalyst::Plugin::Scheduler::Base';
14 # hack the last event check to make all events execute immediately
15 $BASE->_last_check_time( 0 );
19 event => '/cron/every_minute',
25 TestApp->config->{scheduler}->{hosts_allow} = '1.2.3.4';
27 # test that the event does not execute
29 ok( my $res = request('http://localhost/'), 'request ok' );
30 is( $res->content, 'default', 'response ok' );
31 is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", undef, 'every_minute did not execute, ok' );
32 unlink "$FindBin::Bin/lib/TestApp/every_minute.log";
35 # hack the last event check to make all events execute immediately
36 $BASE->_last_check_time( 0 );
39 TestApp->config->{scheduler}->{hosts_allow} = [ '1.2.3.4', '127.0.0.1' ];
41 # test that the event does execute
43 ok( my $res = request('http://localhost/'), 'request ok' );
44 is( $res->content, 'default', 'response ok' );
45 is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", 1, 'every_minute executed ok' );
46 unlink "$FindBin::Bin/lib/TestApp/every_minute.log";