Created
November 9, 2014 12:04
-
-
Save yusukebe/1157c71b7f9b13c3c927 to your computer and use it in GitHub Desktop.
just poc
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 strict; | |
use warnings; | |
use MyApp; | |
use Test::JSON::RPC::Autodoc; | |
my $psgi = MyApp->new(); | |
my $test = Test::JSON::RPC::Autodoc->new({ | |
document_root => '/docs', | |
app => $psgi->to_app() | |
}); | |
my $rpc_req = $test->new_request(); | |
$rpc_req->params( | |
name => { type => 'Str', required => 1, documentation => 'Name of you.' }, | |
age => { type => 'Int', documentation => 'Age of you.' } | |
); | |
$rpc_req->post_ok( '/', 'some_method', { name => 'yusuke', age => 32 } ); | |
my $res = $rpc_req->response(); | |
my $data = $res->from_json(); | |
is $data->{result}{your_name}, 'yusuke'; | |
$rpc_req->write('sample.md'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment