[Catalyst] Catalyst testing

Jonathan Rockway jon at jrock.us
Mon Jul 31 03:13:05 CEST 2006


Here's something that's been bugging me for a while.  With
Catalyst::Test, you don't have any chance to change MyApp->config before
your various models and views are instantiated.  In my foo.t, I want to:

1. Load the Catalyst module (has to happen eventually).
2. Before my models get instantiated, dynamically generate the
configuration.  Basically this consists of creating a temporary
directory somewhere, and setting MyApp->config->{base} to point to it. 
(In case you missed my YAPC talk, my blog software stores everything in
the filesystem.  I want a clean slate to start with, then my test adds
articles and comments and makes sure everything works as expected.)
3. Let Catalyst startup.

If Catalyst starts before the config is changed, it will die during
Model instantiation because config->{base} is invalid.  So as you can
see, I'm having a hard time writing good tests :)   (I could use the
default, hard-coded {base}, but I'm against touching the user's
filesystem during tests.  Autocreated tempdirs are fine, but using their
actual config file and messing around with things is unacceptable. :)

Any ideas / suggestions would be appreciated.  Thanks!

Oh, and here's the software in question:
L<http://www.jrock.us/trac/blog_software/>.  (Still pre-alpha, though,
so don't flame me too much :)

Regards,
Jonathan Rockway

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 370 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060730/4eb177d2/attachment.pgp 


More information about the Catalyst mailing list