thank you, daniel.  this was somewhat embarrassing.   I had used many 
different .t before, and as I whittled both the app and the .t further and 
further, eventually what I had attributed to a bad .t had become a bad app.

thank you for seeing it.  and thank you for the testing hint on not needing 
localhost.

a minimal working example of a use or feature always helps, so let me just 
post the working code for future users.

#!/usr/bin/env perl
use Test::More;
use Test::Mojo;

use FindBin;
require "$FindBin::Bin/quicksheet";

my $t = Test::Mojo->new;
$t->get_ok('/')->status_is(200)->content_like(qr{<h1>TITLE: basic 
mojolicious cribsheet</h1>});
$t->get_ok('/')->status_is(200)->content_unlike(qr{<h1>bad: basic 
mojolicious cribsheet</h1>});

my $teststringG='this-is-my-Gtest-text';
$t->get_ok( '/' => form => { from => '/', someget => $teststringG, id => '
formget' } )
    ->status_is(200)
    ->content_like( qr{<span>$teststringG</span>}ms );

my $teststringP='this-is-my-Ptest-text';
$t->post_ok( '/' => form => { from => '/', somepost => $teststringP, id => '
formpost' } )
    ->status_is(200)
    ->content_like( qr{Post Result: <span>$teststringP</span>}ms );

done_testing();


on

#!/usr/bin/env perl
use Mojolicious::Lite;

my $indexpage= sub {
  my $c = shift; 
  $c->render(template => 'index' );
};

get '/' => $indexpage;
post '/' => $indexpage;

app->start;

__DATA__

@@ index.html.ep

% layout 'default';
% title 'basic mojolicious cribsheet';

<h1>TITLE: <%= title %></h1>

  <h2> FORM GET </h2>

  <form action='/' method='GET' id="formget">
    <input id="getidsometext" name="someget" value="this was get" />
    <input id="getsubmit" type="submit">
  </form>

  <p>Get Result: <span><%= ($self->req->query_params->param("someget")) || 
"no text yet" %></span></p>


  <h2> FORM POST </h2>

  <form action='/?ab=12' method='POST' id="formpost">
    <input id="postidsometext" name="somepost" value="this was post" />
    <input id="postsubmit" type="submit">
  </form>

  <p>Post Result: <span><%= ($self->req->params->param("somepost")) || "no 
text yet" %></span> .<br />
   Query Params: <span><%= ($self->req->query_params->param("ab")) || "ab 
not seen" %></span></p>

@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
  <head>
    <title><%= title %></title>
  </head>


  <body style="margin:3em; background-color:beige">
    <%= content %>
  </body>
</html>


and the test passes. 


-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to