Yeah ! I have found a way ! It's really not easy !!! So, here the code : use url; Dancer::set environment => 'testing'; Dancer::Config->load; use Dancer::Test; Never ever do a use Dancer when I use my module which use Dancer. And so, I have fix the Redis plugin : I do my $settings; register_redis => sub { $settings ||= plugin_setting; ... } Ok not it's ok, the test can run ! I send the patch to the author. Le 28 mars 2011 à 23:17, Geistteufel a écrit :
Everything works if I run bin/app.pl, but no way under test
Could you take a look at there :
https://github.com/geistteufel/Dancer-Plugin-Redis/blob/master/lib/Dancer/Pl...
I don't get at all what is the problem of this plugin ???
In fact, I have try to Dumper settings, under the "register" function, and surprise : nothing at all. So Redis take only default params, which is not the test.
plugin_settings seems to give nothing at all.
I do that :
use Dancer; Dancer::set environment => 'testing'; Dancer::Config->load; use Dancer::Plugin::Redis;
And die Dumper $settings in the module, give me
$VAR1 = {}
...
Any idea ?
Le 28 mars 2011 à 13:12, sawyer x a écrit :
Hey
I looked into it, and apparently Dancer::Test does check for the environment:
in file: use Dancer::Test; use Dancer::Config;
print Dancer::Config::setting('mykey'), "\n"; --
If I run it as: DANCER_ENVIRONMENT=test perl -Ilib file.pl ... it does print the value of the key 'mykey' configured in test.yml inside 'environments'.
So there is no problem there.