[Dancer-users] How to select a specific environment when I do "make test"

Geistteufel geistteufel at yahoo.fr
Sun Mar 27 20:00:28 CEST 2011


I have try this way too, but doesn't work :

#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 2;

# the order is important
use url;
Dancer::Config::setting({environment => 'testing'});
Dancer::Config->load;
use Dancer::Test;

route_exists [GET => '/'], 'a route handler is defined for /';
response_status_is ['GET' => '/'], 200, 'response status is 200 for /';



Le 27 mars 2011 à 19:52, Geistteufel a écrit :

> I don't know how to do it,
> 
> Look at these code :
> 
> use url;
> use Dancer::Test;
> 
> route_exists [ GET => '/' ], 'a route';
> 
> #It crash, because it try to load development environment and my server is down for testing purpose
> 
> So I want to add environment "testing"
> 
> I do that :
> 
> use Dancer;
> set environment => "testing";
> use Dancer::Config;
> Dancer::Config->load;
> 
> And then I redo the same code,
> 
> It just doesn't work. It doesn't load the "testing" file. And keep crashing on the same port.
> 
> The only differrence is in the Redis conf :
> 
> #config.yml
> plugins:
>     Redis:
>         server: '127.0.0.1:6379'
>         debug: 0
> 
> #environments/testing.yml
> plugins:
>     Redis:
>         server: '127.0.0.1:16379'
>         debug: 0
> 
> Is they an easy way to set this, even in all testing file (I can add an init in my "t" directory, to do it).
> 
> Le 27 mars 2011 à 19:07, sawyer x a écrit :
> 
>> 
>> On Sun, Mar 27, 2011 at 7:05 PM, Geistteufel <geistteufel at yahoo.fr> wrote:
>> My preference should be to set the environment in the Makefile.PL only when I do "make test".
>> It's better that doing this everywhere.
>> 
>> That's also an option.
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110327/874b70fa/attachment-0001.htm>


More information about the Dancer-users mailing list