Ado
view release on metacpan or search on metacpan
t/command/crud.t view on Meta::CPAN
},
'args are ok'
);
is(ref($c->routes), 'ARRAY', '$c->routes ISA ARRAY');
is_deeply(
$c->routes->[0],
{ route => '/testatii',
via => ['GET'],
to => "testatii#list",
},
'first root is OK'
);
#create the table
for my $sql (@$create_table) {
$ado->dbix->dbh->do($sql);
}
$ado->dbix->query(
'INSERT INTO testatii(title,body,user_id,group_id)' . 'VALUES(?,?,?,?)',
'Hello', 'more text in the body',
2, 2
);
$ado->dbix->query(
'INSERT INTO testatii(title,body,user_id,group_id)' . 'VALUES(?,?,?,?)',
'Hello2', 'more text in the body2',
2, 2
);
ok($c->run);
unshift @INC, $c->args->{lib};
#Run tests on the generated code?!?!
unshift @{$ado->renderer->paths}, catdir($tempdir, 'site_templates');
$t->get_ok('/testatii/list', {Accept => 'text/plain'})->status_is(415)
->content_like(qr|Unsupported.+Please.+list\.json|x, 'Unsupported Media Type - ok');
$t->get_ok('/testatii/list.json')->status_is(200);
$t->get_ok('/testatii/list.html')->status_is(200)
->content_like(qr|table.+id</th>.+permissions</th.+Hello</td.+Hello2|smx);
$t->post_ok(
'/testatii/create.html' => form => {
title => 'Hello3',
body =>
'Ðла, бала, ниÑа ÑÑÑÑка паниÑа, Хей гиди ÐанÑо, Ð½Ð°Ñ ÐºÐ°Ð¿Ð¸ÑанÑо...'
}
);
$t->get_ok('/testatii/read/3.html')->status_is(200)
->content_like(qr|Hello3|smx, 'reading content - ok');
$t->put_ok(
'/testatii/update/3.html' => form => {
id => 3,
title => 'Hello3 Updated',
body =>
'Ðла, бала, ниÑа ÑÑÑÑка паниÑа, Хей гиди ÐанÑо, Ð½Ð°Ñ ÐºÐ°Ð¿Ð¸ÑанÑо...'
}
);
$t->get_ok('/testatii/read/3.html')->status_is(200)
->content_like(qr|Hello3\sUpdated</h1>|smx, 'reading updated content - ok');
=pod
=cut
#drop the table
$ado->dbix->dbh->do($create_table->[0]);
done_testing();
( run in 0.545 second using v1.01-cache-2.11-cpan-99c4e6809bf )