On Wed, Sep 26, 2012 at 1:15 AM, Manni Heumann <heum...@strato-rz.de> wrote:

> Bill Moseley <mose...@hank.org> schrieb am 25.09.2012:
>
> > The app has a myapp.yml config which includes configuration for
> > creating an instance of a Model component -- and part of that Model's
> > config is a database dsn attribute.   When running my test I do want
> > to have the app load this config file -- but I want to modify it
> > on-the-fly.
>
> Why? Why not simply create a myapp_test.yml file and set
> CATALYST_CONFIG_LOCAL_SUFFIX to "test" when you run your test-suite?
>

I guess this is probably the cleanest/easiest.   Create my database and
write out the config in a BEGIN block -- or somehow otherwise delay loading
Catalyst::Test.

My other option could be to create my own instance of the Model object and
then swap it out in the MyApp->components hash.   The fact that my model is
dynamically generated at startup based on config adds a bit of complexity
to it -- but that can be handled.


BTW -- for tests where I need to build a database on-the-fly what I
currently do is set my "make test" config use dsn => 'dbi:Pg' and then set
the PG* environment variables.   But, in this case what I'm doing is
swapping my Postgresql config in my configuration with one to use a SQLite
database in a temporary file just for a few tests.

Thanks for the ideas.


-- 
Bill Moseley
mose...@hank.org
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to