b3e48cb20dc2e44840679c0bcaec0ad25273c51c
[catagits/Catalyst-Plugin-Scheduler.git] / t / 08yaml.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 use Storable qw/lock_store lock_retrieve/;
10
11 plan tests => 3;
12 use Catalyst::Test 'TestApp';
13
14 our $STATE = "$FindBin::Bin/lib/TestApp/scheduler.state";
15
16 # hack the last event check to make all events execute immediately
17 my $state = { last_check => 0 };
18 lock_store $state, $STATE;
19
20 # configure a yaml file
21 TestApp->config->{scheduler}->{yaml} = "$FindBin::Bin/lib/TestApp/test.yml";
22
23 # test that the plugin event executes
24 {
25     ok( my $res = request('http://localhost/'), 'request ok' );
26     is( $res->content, 'default', 'response ok' );
27     is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", 1, 'every_minute executed ok' );
28     unlink "$FindBin::Bin/lib/TestApp/every_minute.log";
29 }
30