Hi. I have a Dancer2 app. I want to test it properly against a database. For every test run I create a new database and a new empty schema (PostgreSQL). My new database has a random name (e.g. app_123abc) and at the end of the test I drop the database. How can I change the Dancer2 app configuration during the test run, or before I do my $test = Plack::Test->create( $app ); ? As it is, is just loads the config files for development. I want to provide my own configuration programmatically. Creating files in the current directory is not an option. I have tried: config->{'my_stuff'} = \%my_stuff set 'my_stuff' => \%my_stuff but Dancer2 doesn't seems to pick it up or it gets overwritten later by the config from the files. Example: #!/perl ## no critic (Modules::ProhibitMultiplePackages) use strict; use warnings; use 5.014; # JSON::PP included in CORE. package ConfigChangeTest; use Dancer2; set serializer => 'JSON'; get qr{/info}msx => sub { return { appname => config->{'appname'}, }; }; package main; use Test2::V0 -srand => time, qw(:DEFAULT); use Plack::Test; use HTTP::Request; use JSON; use Dancer2; my $appname = 'ConfigChangeTest'; set appname => $appname; my $test = Plack::Test->create( ConfigChangeTest->to_app ); my $req = HTTP::Request->new( GET => '/api/1/info' ); my $res = $test->request( $req ); ok( $res->is_success, 'Is success' ); # Fails! # appname is the one set in the file `environments/development.yml` or + file `config.yml`. is( decode_json $res->content, { appname => $appname, }, 'Is right con +tent' ); done_testing; -- Mikko Koivunalho LinkedIn: http://www.linkedin.com/in/MikkoKoivunalho AboutMe: http://about.me/mikkokoivunalho Blog: http://www.koivunalho.org/blogs/exercises-in-integration-and-delivery/ [ This message has been signed with PGP. Public key attached. ]