[Catalyst] Run catalyst tests against another database
Bill Moseley
moseley at hank.org
Sat Feb 6 23:09:08 GMT 2010
On Sat, Feb 6, 2010 at 2:01 PM, John Atzger <jatzger at hotmail.com> wrote:
> I want my Catalyst tests to run against a test database. I wrote this:
>
> package MyApp::Model::DB;
> use strict;
> use base 'Catalyst::Model::DBIC::Schema';
>
> BEGIN {
> require MyApp;
> my $db =3D $ENV{HARNESS_ACTIVE} ? 'test' : 'myapp';
> my $config =3D MyApp->config->{database}{$db};
>
> __PACKAGE__->config(
> schema_class =3D> 'MyApp::Schema',
> connect_info =3D> {
> dsn =3D> $config->{dsn},
> user =3D> $config->{user},
> password =3D> $config->{password},
> );
> }
>
> I don't want test information in my code. How do people do this?
>
I use separate config files that get merged into the main config.
-- =
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100206/50ab1=
048/attachment.htm
More information about the Catalyst
mailing list