This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$t->get_ok('/welcome.json') | |
->json_content_is( | |
{ message => 'Unicorns can make cookies with their minds' } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $c = Mojo::Client->new; | |
$c->post_form( 'http://api.webservice.com/accounts' => | |
{ name => 'unicorn', career => 'baker', type => 'magical' } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$t->post_form_ok( 'http://api.webservice.com/accounts' => | |
{ name => 'unicorn', career => 'baker', type => 'magical' } ) | |
->status_is(201) | |
->header_is('content-type' => 'application/json') | |
->json_content_is( { id => 'uni123', name => 'unicorn' } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$t->reset_session; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $tx = $t->tx; | |
is $tx->res->json->{thiskey} => 'exists'; | |
eq_or_diff $tx->res->json->{arbitrary} => { data => 'structure' }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$t->get_ok(...); | |
$t->head_ok(...); | |
$t->put_ok(...); | |
$t->post_ok(...); | |
$t->post_form_ok(...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<div> | |
<ul> | |
<li><a href="#sad_unicorns">Sad Unicorns</a></li> | |
<li><a href="#marshmallow_death">Marshmallow Death</a></li> | |
<li><a href="http://external.url.com/">Laser Beam Eyes</a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use File::Slurp 'slurp'; | |
use Mojo::DOM; | |
my $dom = Mojo::DOM->new->parse(slurp 'some.html'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dom->find('li a') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use File::Slurp 'slurp'; | |
use Mojo::DOM; | |
my $dom = Mojo::DOM->new->parse(scalar slurp 'some.html'); |