=================================================================== RCS file: /cvs/todotxt/Text-Todo-REST-API/t/GET.t,v retrieving revision 1.1 retrieving revision 1.7 diff -u -r1.1 -r1.7 --- todotxt/Text-Todo-REST-API/t/GET.t 2010/01/17 19:41:24 1.1 +++ todotxt/Text-Todo-REST-API/t/GET.t 2010/01/26 06:03:11 1.7 @@ -7,15 +7,16 @@ # AUTHOR: Andrew Fresh (AAF), andrew@cpan.org # COMPANY: Red River Communications # CREATED: 01/07/10 19:11 -# REVISION: $AFresh1$ +# REVISION: $AFresh1: GET.t,v 1.6 2010/01/24 04:17:39 andrew Exp $ #=============================================================================== use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 6; my $class; + BEGIN { $class = 'Text::Todo::REST::API'; use_ok( $class, "use $class" ); @@ -23,9 +24,13 @@ diag("Testing GET $class $Text::Todo::REST::API::VERSION"); -my $api = new_ok( $class, [ { basedir => 't', path_info => '/lists/todo' } ] ); +my $api = new_ok( $class, [ { todo_dir => 't/lists' } ] ); my $result; -ok( !eval { $result = $api->GET() }, 'GET method' ); -like( $@, '/^Unable to Dump \[list\]/', 'Failed GET as expected' ); -$result = undef; +ok( eval { $result = $api->GET('/files.txt') }, 'GET method' ); +is( ( ref $result ), + 'Text::Todo::REST::API::Response', + 'Got expected result' +); +is_deeply( $result->data, ['todo.txt'], 'Got proper data' ); +is( $result->render, "todo.txt\n", "Rendered properly" );