[BACK]Return to dudelicious.t CVS log [TXT][DIR] Up to [local] / todotxt / Text-Todo / t

Annotation of todotxt/Text-Todo/t/dudelicious.t, Revision 1.3

1.3     ! andrew      1: #!perl
        !             2: use Test::More;    # tests => 3;
        !             3:
        !             4: use strict;
        !             5: use warnings;
        !             6:
        !             7: use File::Temp qw/ tempdir /;
        !             8: use File::Copy qw/ cp /;
        !             9: use File::Spec;
1.1       andrew     10:
                     11: BEGIN {
1.3     ! andrew     12:     eval "use Test::Mojo";
        !            13:     plan skip_all => "Test::Mojo required for testing dudelicious" if $@;
        !            14:
        !            15: }
1.1       andrew     16:
1.3     ! andrew     17: my $todo_dir = tempdir( 'todo-XXXXXXXXX', CLEANUP => 1, TMPDIR => 1 );
        !            18: $ENV{DUDELICIOUS_HOME} = $todo_dir;
        !            19:
        !            20: foreach my $file qw( todo1.txt todo.list.txt dudelicious.conf ) {
        !            21:     cp( File::Spec->catfile( 't',       $file ),
        !            22:         File::Spec->catfile( $todo_dir, $file ),
        !            23:     ) || die "Couldn't cp [$todo_dir]/[$file]: $!";
1.1       andrew     24: }
                     25:
1.3     ! andrew     26: require File::Spec->catfile( 'bin', 'dudelicious.pl' );
        !            27: Dudelicious->import;
        !            28: Dudelicious->app->log->level('error');
1.1       andrew     29:
                     30: my $t = Test::Mojo->new;
                     31:
                     32: # Index page
1.3     ! andrew     33: $t->get_ok('/')->status_is(200)->content_like(qr/todo1\.txt/xms);
        !            34:
        !            35: $t->get_ok('/l/todo1')->status_is(200)->content_is(
        !            36:     q{<!doctype html><html>
        !            37:     <head><title>Funky!</title></head>
        !            38:     <body><h1>todo1</h1>
        !            39: <ol>
        !            40:     <li>
        !            41: (B) +GarageSale @phone schedule Goodwill pickup
        !            42:     </li>
        !            43:     <li>
        !            44: +GarageSale @home post signs around the neighborhood DUE:2006-08-01
        !            45:     </li>
        !            46:     <li>
        !            47: X eat meatballs @home
        !            48:     </li>
        !            49:     <li>
        !            50: (A) @phone thank Mom for the meatballs WAIT
        !            51:     </li>
        !            52:     <li>
        !            53:
        !            54:     </li>
        !            55:     <li>
        !            56: @shopping Eskimo pies
        !            57:     </li>
        !            58:     <li>
        !            59: email andrew@cpan.org for help +report_bug @wherever
        !            60:     </li>
        !            61:     <li>
        !            62: x 2009-01-01 completed with a date
        !            63:     </li>
        !            64: </ol>
        !            65: </body>
        !            66: </html>
        !            67: }
        !            68: );
        !            69:
        !            70: $t->get_ok('/l/todo1.txt')->status_is(200)->content_is(
        !            71:     q{(B) +GarageSale @phone schedule Goodwill pickup
        !            72: +GarageSale @home post signs around the neighborhood DUE:2006-08-01
        !            73: X eat meatballs @home
        !            74: (A) @phone thank Mom for the meatballs WAIT
        !            75:
        !            76: @shopping Eskimo pies
        !            77: email andrew@cpan.org for help +report_bug @wherever
        !            78: x 2009-01-01 completed with a date
        !            79: }
        !            80: );
        !            81:
        !            82: $t->get_ok('/l/todo1/e/1')->status_is(200)->content_is(
        !            83:     q{<!doctype html><html>
        !            84:     <head><title>Funky!</title></head>
        !            85:     <body>(B) +GarageSale @phone schedule Goodwill pickup
        !            86: </body>
        !            87: </html>
        !            88: }
        !            89: );
        !            90:
        !            91: $t->get_ok('/l/todo1/e/1.txt')->status_is(200)->content_is(
        !            92:     q{(B) +GarageSale @phone schedule Goodwill pickup
        !            93: }
        !            94: );
        !            95:
        !            96: done_testing();

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>