13 use_ok('Catalyst::Test');
15 eval "get('http://localhost')";
16 isnt( $@, "", "get returns an error message with no app specified");
18 eval "request('http://localhost')";
19 isnt( $@, "", "request returns an error message with no app specified");
21 sub customize { Catalyst::Test::_customize_request(@_) }
24 my $req = Catalyst::Utils::request('/dummy');
26 is( $req->header('Host'), undef, 'normal request is unmodified' );
30 my $req = Catalyst::Utils::request('/dummy');
31 customize( $req, { host => 'customized.com' } );
32 like( $req->header('Host'), qr/customized.com/, 'request is customizable via opts hash' );
36 my $req = Catalyst::Utils::request('/dummy');
37 local $Catalyst::Test::default_host = 'localized.com';
39 like( $req->header('Host'), qr/localized.com/, 'request is customizable via package var' );
43 my $req = Catalyst::Utils::request('/dummy');
44 local $Catalyst::Test::default_host = 'localized.com';
45 customize( $req, { host => 'customized.com' } );
46 like( $req->header('Host'), qr/customized.com/, 'opts hash takes precedence over package var' );
50 my $req = Catalyst::Utils::request('/dummy');
51 local $Catalyst::Test::default_host = 'localized.com';
52 customize( $req, { host => '' } );
53 is( $req->header('Host'), undef, 'default value can be temporarily cleared via opts hash' );
56 # Back compat test, extra args used to be ignored, now a hashref of options.
57 use_ok('Catalyst::Test', 'TestApp', 'foobar');