On Sep 2, 2009, at 10:48 AM, Tomas Doran wrote:
On 1 Sep 2009, at 04:43, fREW Schmidt wrote:
I'd really like to start testing my controllers, and I wished I'd
started sooner, but oh well. The biggest barrier at this point is
the login system. It uses OpenID for auth, which is where the
hard stuff comes from.
<snip>
Why bother with the complexity when testing if it isn't the OpenID
stuff your testing specifically.
I'd arrange for the relevant tests to supply a custom config file
(I do this by mangling MYAPP_CONFIG env variable in the tests,
although I'm sure there are more elegant solutions)..
This is what I've adopted. I have "permanent" config in myapp.yml and
then whatever site customization in myapp_local.yml and then a
configuration file specifically for testing (substituting DB config
normally) myapp_test.yml
And then a test like:
BEGIN {
$ENV{MYAPP_CONFIG_LOCAL_SUFFIX} = "test";
}
use strict;
use warnings;
use Test::More "no_plan";
use Test::WWW::Mechanize::Catalyst;
# etc...
That will pick up the right config and override your core stuff where
needed/desired. I don't know if this is a widespread practice but
I've been doing it for a long time now and really like it.
-Ashley
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/