=================================================================== RCS file: /cvs/todotxt/Text-Todo-REST-API/t/GET/list.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- todotxt/Text-Todo-REST-API/t/GET/list.t 2010/01/18 13:47:53 1.2 +++ todotxt/Text-Todo-REST-API/t/GET/list.t 2010/01/23 07:15:40 1.3 @@ -7,15 +7,16 @@ # AUTHOR: Andrew Fresh (AAF), andrew@cpan.org # COMPANY: Red River Communications # CREATED: 01/07/10 19:11 -# REVISION: $AFresh1: list.t,v 1.1 2010/01/17 19:41:24 andrew Exp $ +# REVISION: $AFresh1: list.t,v 1.2 2010/01/18 13:47:53 andrew Exp $ #=============================================================================== use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 17; my $class; + BEGIN { $class = 'Text::Todo::REST::API'; use_ok( $class, "use $class" ); @@ -23,7 +24,7 @@ diag("Testing GET list $class $Text::Todo::REST::API::VERSION"); -my $api = new_ok( $class, [ { todo_dir => 't/lists', path_info => '/todo' } ] ); +my $api = new_ok( $class, [ { todo_dir => 't/lists' } ] ); my $list_should_be = [ { 'text' => '(A) entry 1 @one +uno', @@ -53,6 +54,18 @@ ]; my @list; -ok( @list = $api->get_list, 'Get List' ); +ok( @list = $api->get_list( $api->_todo), 'get_list' ); is( scalar @list, 6, 'list is right length' ); is_deeply( \@list, $list_should_be, 'check that we got the right list' ); + +foreach my $arg ( + 'todo_file', '/todo_file/list', + { path => '/todo_file/list' }, + { list => 'todo_file', action => 'list', args => [] }, + ) +{ + my @list; + ok( @list = $api->GET($arg), "GET($arg)" ); + is( scalar @list, 6, 'list is right length' ); + is_deeply( \@list, $list_should_be, 'check that we got the right list' ); +}