=================================================================== RCS file: /cvs/todotxt/Text-Todo/t/dudelicious.t,v retrieving revision 1.5 retrieving revision 1.9 diff -u -r1.5 -r1.9 --- todotxt/Text-Todo/t/dudelicious.t 2010/04/30 02:42:20 1.5 +++ todotxt/Text-Todo/t/dudelicious.t 2010/05/05 02:24:20 1.9 @@ -1,4 +1,5 @@ #!perl +# $AFresh1: dudelicious.t,v 1.8 2010/05/01 22:38:24 andrew Exp $ use Test::More; # tests => 3; use strict; @@ -8,10 +9,11 @@ use File::Copy qw/ cp /; use File::Spec; +my $have_test_json = 1; + BEGIN { eval "use Test::Mojo"; plan skip_all => "Test::Mojo required for testing dudelicious" if $@; - } my $todo_dir = tempdir( 'todo-XXXXXXXXX', CLEANUP => 1, TMPDIR => 1 ); @@ -52,12 +54,20 @@ SKIP: { skip "$f does not exist", 3 if !-e $f; - diag("Getting [$f] from [$p]"); open my $fh, '<', $f or die $f . ': ' . $!; - $t->get_ok($p)->status_is(200)->content_is( - do { local $/; <$fh> } - ); + my $content = do { local $/; <$fh> }; close $fh; + + $t->get_ok( $p, {}, undef, "Get [$f] from [$p]" ) + ->status_is(200, 'With 200 status'); + + if ( $f =~ /\.json$/xms ) { + $t->json_content_is( Mojo::JSON->decode($content), + 'Check JSON content' ); + } + else { + $t->content_like( qr/\Q$content\E/xms, 'Check content' ); + } } }