[Dancer-users] How to select a specific environment when I do "make test"
Geistteufel
geistteufel at yahoo.fr
Mon Mar 28 23:22:47 CEST 2011
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/Plugin/Redis.pm
>
>
> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110328/aac4197f/attachment.htm>
More information about the Dancer-users
mailing list