X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_catalyst_test.t;h=f4f695ed4e7f08212668bfd78e3f8c4a1583e7db;hb=269194b4f9de3905430a2d1f21f68da13b2b9ed9;hp=6f1bacc3bc1b2998f10b2130496749868d04f178;hpb=38007d99db1774891d373242c86382e6f5cb083a;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live_catalyst_test.t b/t/live_catalyst_test.t index 6f1bacc..f4f695e 100644 --- a/t/live_catalyst_test.t +++ b/t/live_catalyst_test.t @@ -1,11 +1,32 @@ use FindBin; use lib "$FindBin::Bin/lib"; -use Catalyst::Test 'TestApp'; +use Catalyst::Test 'TestApp', {default_host => 'default.com'}; +use Catalyst::Request; -use Test::More tests => 5; +use Test::More tests => 8; content_like('/',qr/root/,'content check'); action_ok('/','Action ok ok','normal action ok'); action_redirect('/engine/response/redirect/one','redirect check'); action_notfound('/engine/response/status/s404','notfound check'); -contenttype_is('/action/local/one','text/plain','Contenttype check'); \ No newline at end of file +contenttype_is('/action/local/one','text/plain','Contenttype check'); + +my $creq; +my $req = '/dump/request'; + +{ + eval '$creq = ' . request($req)->content; + is( $creq->uri->host, 'default.com', 'request targets default host set via import' ); +} + +{ + local $Catalyst::Test::default_host = 'localized.com'; + eval '$creq = ' . request($req)->content; + is( $creq->uri->host, 'localized.com', 'target host is mutable via package var' ); +} + +{ + my %opts = ( host => 'opthash.com' ); + eval '$creq = ' . request($req, \%opts)->content; + is( $creq->uri->host, $opts{host}, 'target host is mutable via options hashref' ); +}