[Catalyst-dev] subdomain hook for Catalyst::Test
Jason Gottshall
jgottshall at capwiz.com
Tue Sep 30 20:00:47 BST 2008
Jason Gottshall wrote:
> Matt S Trout wrote:
>> Could we not make request() take the domain or something?
>>
>> It's currently single argument so adding an options hashref would be
>> fine, plus maybe some way to provide default values therefore in the
>> cases where we're doing request() from inside other code?
>
> Sounds like a nice idea. Maybe the default value could be dealt with at
> import time:
>
> use Test::More tests => 2;
> use Catalyst::Test 'MyApp', { default_subdomain => 'fizzle' };
>
> ok( request( '/foo/' )->is_success, 'foo succeeds for fizzle' );
> ok( request( '/foo/', { subdomain => 'snazzle' } )->is_redirect, 'foo
> redirects for snazzle');
Incidentally, anybody have any suggestions on how to write tests for
this behavior? I can't find any tests for Catalyst::Test itself in the
test suite. I'm thinking I could use the existing /dump/request action
in the TestApp, deserialize the request object (based on examples in the
live engine tests) and check that the request URI actually has the
subdomain injected properly. Is that sufficient? Is there an existing
test script to which I should add this, or would it make more sense to
start a new file? And what would I call it? (live_test.t, unit_test.t,
test_test_test.t?)
Jason
More information about the Catalyst-dev
mailing list