diff options
Diffstat (limited to 't/01-basic.t')
-rw-r--r-- | t/01-basic.t | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/t/01-basic.t b/t/01-basic.t index ef89f37..f3f5987 100644 --- a/t/01-basic.t +++ b/t/01-basic.t @@ -35,16 +35,24 @@ use Path::Class (); package Foo; use OX; - config template_root => sub { - Path::Class::dir($FindBin::Bin)->subdir('data', '01', 'templates') - }; + has template_root => ( + is => 'ro', + isa => 'Str', + block => sub { + Path::Class::dir($FindBin::Bin)->subdir('data', '01', 'templates')->stringify + }, + ); - component View => 'OX::View::TT', ( - template_root => depends_on('/Config/template_root'), + has view => ( + is => 'ro', + isa => 'OX::View::TT', + dependencies => ['template_root'], ); - component Controller => 'Foo::Controller', ( - view => depends_on('/Component/View'), + has controller => ( + is => 'ro', + isa => 'Foo::Controller', + dependencies => ['view'], ); router as { @@ -52,11 +60,11 @@ use Path::Class (); content => 'Hello world', ); route '/foo' => 'root.foo'; - }, (root => depends_on('/Component/Controller')); + }, (root => depends_on('controller')); } my $foo = Foo->new; -my $view = $foo->resolve(service => '/Component/View'); +my $view = $foo->view; isa_ok($view, 'OX::View::TT'); isa_ok($view->tt, 'Template'); |