Changes:
[catagits/Catalyst-Plugin-Scheduler.git] / t / 08yaml.t
index 6d7d7ea..de4f36d 100644 (file)
@@ -8,14 +8,14 @@ use lib "$FindBin::Bin/lib";
 use Test::More;
 use Storable qw/lock_store lock_retrieve/;
 
-plan tests => 3;
+plan tests => 6;
 use Catalyst::Test 'TestApp';
 
 our $STATE = "$FindBin::Bin/lib/TestApp/scheduler.state";
+our $BASE  = 'Catalyst::Plugin::Scheduler::Base';
 
 # hack the last event check to make all events execute immediately
-my $state = { last_check => 0 };
-lock_store $state, $STATE;
+$BASE->_last_check_time( 0 );
 
 # configure a yaml file
 TestApp->config->{scheduler}->{yaml_file} 
@@ -29,3 +29,11 @@ TestApp->config->{scheduler}->{yaml_file}
     unlink "$FindBin::Bin/lib/TestApp/every_minute.log";
 }
 
+# test that a YAML trigger works
+{
+    ok( my $res = request('http://localhost/?schedule_trigger=some_long_trigger_name'), 'request ok' );
+    is( $res->content, 'default', 'response ok' );
+    is( -e "$FindBin::Bin/lib/TestApp/every_minute.log", 1, 'every_minute executed ok' );
+    unlink "$FindBin::Bin/lib/TestApp/every_minute.log";
+}
+