More granular tests and cleaned up whitespace in templates
This commit is contained in:
parent
8be78a2e31
commit
50a512f2ae
27
t/post.t
27
t/post.t
|
@ -35,11 +35,26 @@ my %invalid_remark = (
|
|||
$t->ua->max_redirects(1);
|
||||
|
||||
# GET
|
||||
$t->get_ok('/post' )->status_is(200)->text_like(h2 => qr/New Thread/);
|
||||
$t->get_ok('/post/1')->status_is(200)->text_like(h2 => qr/New Remark/);
|
||||
$t->get_ok('/post')->status_is(200)
|
||||
->element_exists('form input[name="author"]' )
|
||||
->element_exists('form input[name="title"]' )
|
||||
->element_exists('form textarea[name="post"]')
|
||||
->element_exists('form input[type="submit"]' )
|
||||
->text_like(h2 => qr/New Thread/);
|
||||
|
||||
$t->get_ok('/post/1')->status_is(200)
|
||||
->element_exists('form input[name="author"]' )
|
||||
->element_exists('form textarea[name="post"]')
|
||||
->element_exists('form input[type="submit"]' )
|
||||
->text_like(h2 => qr/New Remark/);
|
||||
|
||||
# POST
|
||||
$t->post_ok('/post' )->status_is(200)->text_like(h2 => qr/New Thread/);
|
||||
$t->post_ok('/post')->status_is(200)
|
||||
->element_exists('form input[name="author"]' )
|
||||
->element_exists('form input[name="title"]' )
|
||||
->element_exists('form textarea[name="post"]')
|
||||
->element_exists('form input[type="submit"]' )
|
||||
->text_like(h2 => qr/New Thread/);
|
||||
|
||||
$t->post_ok('/post', form => \%invalid_title)->status_is(400)
|
||||
->text_like(p => qr/Invalid title/);
|
||||
|
@ -48,7 +63,11 @@ $t->post_ok('/post', form => \%invalid_post)->status_is(400)
|
|||
$t->post_ok('/post', form => \%valid_params)->status_is(200)
|
||||
->text_like(h2 => qr/Threads List/);
|
||||
|
||||
$t->post_ok('/post/1')->status_is(200)->text_like(h2 => qr/New Remark/);
|
||||
$t->post_ok('/post/1')->status_is(200)
|
||||
->element_exists('form input[name="author"]' )
|
||||
->element_exists('form textarea[name="post"]')
|
||||
->element_exists('form input[type="submit"]' )
|
||||
->text_like(h2 => qr/New Remark/);
|
||||
|
||||
$t->post_ok('/post/1', form => \%valid_remark)->status_is(200)
|
||||
->text_like(h2 => qr/Thread - #1/);
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
<form method="post">
|
||||
<div class="author field">
|
||||
<%= label_for author => 'Author' %>
|
||||
<% if (my $previous_author = session->{'author'}) { %>
|
||||
<% if (my $previous_author = session->{'author'}) { =%>
|
||||
<%= text_field author => $previous_author, maxlength => 63, minlength => 1 %>
|
||||
<% } else { %>
|
||||
<% } else { =%>
|
||||
<%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %>
|
||||
<% } %>
|
||||
<% } =%>
|
||||
<% if (my $error = validation->error('author')) { =%>
|
||||
<p class="field-with-error">Invalid author: 1 to 63 characters please.</p>
|
||||
<% } =%>
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
<form method="post">
|
||||
<div class="author field">
|
||||
<%= label_for author => 'Author' %>
|
||||
<% if (my $previous_author = session->{'author'}) { %>
|
||||
<% if (my $previous_author = session->{'author'}) { =%>
|
||||
<%= text_field author => $previous_author, maxlength => 63, minlength => 1 %>
|
||||
<% } else { %>
|
||||
<% } else { =%>
|
||||
<%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %>
|
||||
<% } %>
|
||||
<% } =%>
|
||||
<% if (my $error = validation->error('author')) { =%>
|
||||
<p class="field-with-error">Invalid author: 1 to 63 characters please.</p>
|
||||
<% } =%>
|
||||
|
|
Loading…
Reference in New Issue
Block a user