App-CatalystStarter-Bloated
view release on metacpan or search on metacpan
t/verify_json.t view on Meta::CPAN
## Need to import these or there will be trouble when the perl module
## code doesn't load
use Catalyst::View;
use Catalyst::View::JSON;
$ARGV{'--name'} = "Foo";
my $f1 = Path::Tiny->tempfile;
$f1->spew( $view_with_syntax_error );
stderr_like(
sub { App::CatalystStarter::Bloated::_verify_JSON_view($f1) },
qr/ contains errors and must be edited by hand\./,
"view with syntax error handled correctly"
);
$ARGV{'--name'} = "Bar";
my $f2 = Path::Tiny->tempfile;
$f2->spew( $view_with_missing_config );
stderr_like(
sub { App::CatalystStarter::Bloated::_verify_JSON_view($f2) },
qr/\Q didn't get expose_stash properly configured, must be fixed manually, expected to be ['json']./,
"view with missing export_stash handled"
);
done_testing;
BEGIN {
$view_with_syntax_error = <<'EOV';
t/verify_root.t view on Meta::CPAN
## Need to import these or there will be trouble when the perl module
## code doesn't load
use Catalyst::View;
use Catalyst::View::TT;
note "index changed in Root";
{
my $f = Path::Tiny->tempfile;
$f->spew( $root_controller_plain );
stderr_like(
sub { App::CatalystStarter::Bloated::_verify_Root_index($f) },
qr/Failed fixing Root controller\. Comment out the response body line\./,
"Detects when Root controller does not have index commented out"
);
}
{
my $f = Path::Tiny->tempfile;
$f->spew( $root_controller_with_response_body_commented_out );
stderr_is(
sub { App::CatalystStarter::Bloated::_verify_Root_index($f) },
"",
"Root controller index ok"
);
}
{
my $f = Path::Tiny->tempfile;
$f->spew( $root_controller_with_both );
stderr_is(
sub { App::CatalystStarter::Bloated::_verify_Root_index($f) },
"",
"Root controller index ok when both are ok"
);
}
note "jumbotron added to Root";
{
my $f = Path::Tiny->tempfile;
$f->spew( $root_controller_plain );
stderr_like(
sub { App::CatalystStarter::Bloated::_verify_Root_jumbatron($f) },
qr/Failed adding jumbotron example to Root controller/,
"Detects when Root controller does not have jumbotron"
);
}
{
my $f = Path::Tiny->tempfile;
$f->spew( $root_controller_with_jumbotron );
stderr_is(
sub { App::CatalystStarter::Bloated::_verify_Root_jumbatron($f) },
"",
"Detects when Root controller does have jumbotron"
);
}
{
my $f = Path::Tiny->tempfile;
$f->spew( $root_controller_with_both );
stderr_is(
sub { App::CatalystStarter::Bloated::_verify_Root_jumbatron($f) },
"",
"Root controller jumbotron ok when both are ok"
);
}
done_testing;
BEGIN {
t/verify_tt.t view on Meta::CPAN
## Need to import these or there will be trouble when the perl module
## code doesn't load
use Catalyst::View;
use Catalyst::View::TT;
$ARGV{'--name'} = "Foo";
my $f1 = Path::Tiny->tempfile;
$f1->spew( $view_with_syntax_error );
stderr_like(
sub { App::CatalystStarter::Bloated::_verify_TT_view($f1) },
qr/ contains errors and must be edited by hand\./,
"view with syntax error handled correctly"
);
$ARGV{'--name'} = "Bar";
my $f2 = Path::Tiny->tempfile;
$f2->spew( $view_with_wrong_extension );
stderr_like(
sub { App::CatalystStarter::Bloated::_verify_TT_view($f2) },
qr/ didn't get TEMPLATE_EXTENSION properly configured, must be fixed manually\./,
"view with wrong extension handled correctly"
);
$ARGV{'--name'} = "Baz";
my $f3 = Path::Tiny->tempfile;
$f3->spew( $view_with_missing_wrapper );
stderr_like(
sub { App::CatalystStarter::Bloated::_verify_TT_view($f3) },
qr/ didn't get WRAPPER properly configured, must be fixed manually\./,
"view with wrapper not set handled correctly"
);
$ARGV{'--name'} = "Test";
my $f4 = Path::Tiny->tempfile;
$f4->spew( $view_where_all_is_ok );
stderr_is(
sub { App::CatalystStarter::Bloated::_verify_TT_view($f4) },
"", "view where all is ok gives no error"
);
done_testing;
BEGIN {
$view_with_syntax_error = <<'EOV';
package Foo::View::HTML;
( run in 1.141 second using v1.01-cache-2.11-cpan-49f99fa48dc )