Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dancer::Test doesn't use environment #427

Closed
celogeek opened this issue Mar 27, 2011 · 2 comments
Closed

Dancer::Test doesn't use environment #427

celogeek opened this issue Mar 27, 2011 · 2 comments

Comments

@celogeek
Copy link

I have try many thing, but Dancer::Test stay glue to "development" environment.

So, my try :

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

In my config.yml:
plugins:
Redis:
server: '127.0.0.1:6379'
debug: 0

and in my environments/testing.yml:
plugins:
Redis:
server: '127.0.0.1:16379'
debug: 0

I have shutdown redis server on the "development" port to be sure is the "testing" one which is use. In all my case, it try the first config and fail with port 6379.

So my first try :

DANCER_ENVIRONMENT=testing perl -Ilib t/002_index_route.t
failed.
I have try DANCER_ENVIRONMENT=testing perl bin/app.pl, success !

So I keep trying :

I change this, to this :
use url;
Dancer::Config::setting({environment => 'testing'});
Dancer::Config->load;
use Dancer::Test;
...

failed

I have try this :

BEGIN {
$ENV{DANCER_ENVIRONMENT} = "testing";
}
use url; #he load Dancer, so I don't do this again, if not, it has a warning ...
use Dancer::Test;

this failed too

I don't really know I to make it work. Otherwise, I can't test my apps ! snif ...

@xsawyerx
Copy link
Member

I have looked into the issue, and Dancer::Test does in fact check for the environment. This has been tested using DANCER_ENVIRONMENT environment variable.

@celogeek
Copy link
Author

I config it's good. The issue is on Redis Plugin dancer, Asukrie tell me that they is mistake under the plugin module, I will try to test a fix and check again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants