#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 103;
+use Test::More tests => 108;
use Test::MockModule;
# module compilation
ok($INC{'Maypole/Config.pm'}, 'loads Maypole::Config');
ok($INC{'UNIVERSAL/require.pm'}, 'loads UNIVERSAL::require');
ok($INC{'Maypole/Constants.pm'}, 'loads Maypole::Constants');
+ok($INC{'Maypole/Headers.pm'}, 'loads Maypole::Headers');
ok($INC{'Class/Accessor/Fast.pm'}, 'loads Class::Accessor::Fast');
ok($INC{'Class/Data/Inheritable.pm'}, 'loads Class::Data::Inheritable');
ok(Maypole->can('config'), 'defines a config attribute');
ok(Maypole->can('document_encoding'), 'defines a "document_encoding" accessor');
ok(Maypole->can('content_type'), 'defines a "content_type" accessor');
ok(Maypole->can('table'), 'defines a "table" accessor');
+ok(Maypole->can('headers_in'), 'defines a "headers_in" accessor');
+ok(Maypole->can('headers_out'), 'defines a "headers_out" accessor');
# simple test class that inherits from Maypole
package MyDriver;
my $rv = $driver_class->handler();
ok($r && $r->isa($driver_class), '... created $r');
ok($called{get_request}, '... calls get_request()');
- ok($called{get_request}, '... calls parse_location');
- ok($called{get_request}, '... calls handler_guts()');
- ok($called{get_request}, '... call send_output');
+ ok($called{parse_location}, '... calls parse_location');
+ ok($called{handler_guts}, '... calls handler_guts()');
+ ok($called{send_output}, '... call send_output');
is($rv, 0, '... return status (should be ok?)');
ok(!$init, "... doesn't call init() if init_done()");
+ ok($r->headers_out && $r->headers_out->isa('Maypole::Headers'),
+ '... populates headers_out() with a Maypole::Headers object');
# call again, testing other branches
$driver_class->init_done(0);
$status = -1;
$r->path('/table');
$r->parse_path;
is($r->table, 'table', '... parses "table" from the first part of path');
-ok(!defined $r->action && @{$r->args} == 0,
- '... leaving "action" undefined, and "args" as empty list, if not present');
+ok(@{$r->args} == 0, '... "args" default to empty list');
$r->path('/table/action');
$r->parse_path;
is_deeply($r->args, [qw(arg1 arg2)],
'... "args" are populated from remaning components');
+# ... action defaults to index
+$r->path('/table');
+$r->parse_path;
+is($r->action, 'index', '... action defaults to index');
+
# get_template_root()
can_ok(Maypole => 'get_template_root');
is(Maypole->get_template_root(), '.', '... returns "."');