[Catalyst-dev] subdomain hook for Catalyst::Test
Matt S Trout
dbix-class at trout.me.uk
Wed Oct 1 02:08:16 BST 2008
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.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst-dev
mailing list