[Catalyst-dev] subdomain hook for Catalyst::Test

Jason Gottshall jgottshall at capwiz.com
Wed Oct 1 22:02:03 BST 2008


Matt S Trout wrote:
> On Tue, Sep 30, 2008 at 03:00:47PM -0400, Jason Gottshall wrote:
>> 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?)
> 
> marcus has done a bunch of work on C::Test in 5.80/trunk and I think that
> includes some tests for it.

Hmm, that makes me wonder, should I be attempting to patch 5.70, 5.80, 
or both?





More information about the Catalyst-dev mailing list