Scheduler, refactored to store last run time, last return value, and allow a public...
[catagits/Catalyst-Plugin-Scheduler.git] / t / 08yaml.t
CommitLineData
68f800bd 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
7use lib "$FindBin::Bin/lib";
8use Test::More;
9use Storable qw/lock_store lock_retrieve/;
10
11plan tests => 3;
12use Catalyst::Test 'TestApp';
13
14our $STATE = "$FindBin::Bin/lib/TestApp/scheduler.state";
15
16# hack the last event check to make all events execute immediately
17my $state = { last_check => 0 };
18lock_store $state, $STATE;
19
20# configure a yaml file
8c698cac 21TestApp->config->{scheduler}->{yaml_file}
22 = "$FindBin::Bin/lib/TestApp/test.yml";
68f800bd 23
24# test that the plugin event executes
25{
26 ok( my $res = request('http://localhost/'), 'request ok' );
27 is( $res->content, 'default', 'response ok' );
28 is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", 1, 'every_minute executed ok' );
29 unlink "$FindBin::Bin/lib/TestApp/every_minute.log";
30}
31