Mercurial > pub > Impl
diff _test/Test/Web/View.pm @ 184:7525ea9a071a
IMPL::Web::View::TTLoader tests
author | sergey |
---|---|
date | Thu, 29 Mar 2012 01:54:20 +0400 |
parents | 2184fa28b49e |
children | ae8072f2f2a3 |
line wrap: on
line diff
--- a/_test/Test/Web/View.pm Wed Mar 28 17:28:51 2012 +0400 +++ b/_test/Test/Web/View.pm Thu Mar 29 01:54:20 2012 +0400 @@ -18,15 +18,28 @@ my $loader = TTLoader->new( { INCLUDE_PATH => [ - $this->GetResourceDir('Resources') + $this->GetResourceDir('Resources','TTView') ] }, - ext => '.tt' + ext => '.tt', + initializer => 'global.tt' ); - assert( defined(my $tt = $loader->template('simple') ) ); + # test the loader to be able to find a desired resource + assert( defined($loader->template('simple') ) ); + + # loader should be initialized on demand + assert( not $loader->isInitialized ); - $tt; + # loader should be able to load a document + my $doc = $loader->document('simple'); + assert(defined $doc); + + assert( $loader->isInitialized ); + assert( $loader->context->stash->get('user') eq 'test_user'); + + # document should inherit loader's context + assert( $doc->context->stash->get('user') eq 'test_user'); }; 1; \ No newline at end of file