[Catalyst] Modify config in a test
Carl Franks
fireartist at gmail.com
Wed Sep 26 08:28:52 GMT 2012
On 26 September 2012 06:24, Bill Moseley <moseley at hank.org> wrote:
> I'm using Catalyst::Test on an app.
>
> 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.
>
> My test builds a SQLite database when it runs, and I'd like to be able to
> modify the config as (before) Catalyst creates the instance of the model
> component -- that is just filter the config to inject my temporary database.
>
> The model "dsn" attribute is readonly -- otherwise I could just do
> MyApp->model( 'MyModel' )->dns( $new_dsn );
>
> What's a good, clean way of doing this? Or perhaps a better approach all
> together?
I use git branches to deal with this.
My `develop` branch would contain the test config, and all development
would be done here, or in branches merged back into here.
I'd then create `server-test` and `server-live` branches (you may have
more or less, depending on your workflow) in which I'd modify the
config for that server.
I only ever merge from `develop` into the `server-*` branches - never
back into `develop`.
Carl
More information about the Catalyst
mailing list