use Test::More; use Mojo::File qw{curfile}; use Test::Mojo; my $script = curfile->dirname->sibling('hr2.pl'); my $t = Test::Mojo->new($script); my $example = 'H4sIAKeZJ2gAA8soKSmw0tdPrUjMLchJ1UvOzwUArN4B1xIAAAA%3D%0A'; my %hl_form = (hyperlink => 'http://example.com'); my %mr_form = ( 'hyperlink', $hl_form{'hyperlink'}, 'meta-refresh', 1 ); $t->get_ok('/create')->status_is(200) ->text_like(h1 => qr/Create new hyperlink/); $t->post_ok('/create', form => \%hl_form)->status_is(200) ->attr_like(a => href => qr/$example/); $t->post_ok('/create', form => \%hl_form)->status_is(200) ->attr_like(a => href => qr/--meta-refresh\/$example/); done_testing;