Add 'lazy' to two parameters to let the constructor runs first and set the applicatio...
Laufeyjarson [Thu, 26 Jun 2014 06:09:18 +0000 (23:09 -0700)]
One test had to change, as it assumed the port number would have been set,
when the method was never called.  Calling the method to get the port number
fixes this, by allowing the lazy method to actually be run before the value
is used.

lib/Catalyst/Script/Server.pm
t/aggregate/unit_core_script_server.t

index 5f0ac06..983a995 100644 (file)
@@ -37,6 +37,7 @@ has port => (
     cmd_aliases   => 'p',
     isa           => 'Int',
     is            => 'ro',
+    lazy          => 1,
     default       => sub {
         Catalyst::Utils::env_value(shift->application_name, 'port') || 3000
     },
@@ -107,6 +108,7 @@ has restart => (
     cmd_aliases   => 'r',
     isa           => 'Bool',
     is            => 'ro',
+    lazy          => 1,
     default       => sub {
         Catalyst::Utils::env_value(shift->application_name, 'reload') || 0;
     },
index b096c42..c4d3c5b 100644 (file)
@@ -151,7 +151,7 @@ sub testBackgroundOptionWithFork {
 
     ## Check a few args
     is_deeply $app->{ARGV}, $argstring;
-    is $app->{port}, '3000';
+    is $app->port, '3000';
     is($app->{background}, 1);
 }