7

I would like to be able to just type "make test" in a dancer app toplevel source directory (the one that was generated by "dancer -a appname") and have it run the tests with the environment set to 'test'.

Or if anyone can point me to repository that I can refer to as a sort of "best practice for developing dancer app" for this that would be great!

holygeek
  • 15,653
  • 1
  • 40
  • 50

2 Answers2

0

You could modify the makefile to set the DANCER_ENVIRONMENT variable appropriately.

If I had my druthers, just using Dancer::Test would automatically set the environment though.

perlpilot
  • 101
  • 2
  • Modifying the makefile is not good enough as the content will be overwritten the next time I run "perl Makefile.PL". I can ask Makefile.PL to produce a differently named makefile and provide my own makefile that sets the environment variable but that would be a tad ugly. Looking through Dancer::Test source code it seems like it doesn't do that. – holygeek Sep 26 '11 at 05:20
0

I did some checking and found the following thread on the dancer-users mailing list:

http://lists.perldancer.org/pipermail/dancer-users/2011-March/001277.html

In a nutshell; In your test files include:

use Dancer::Test;
Dancer::set environment => 'testing';
Dancer::Config->load;

Don't do:

use Dancer;

I've not tested this though; but the user from the post states that it worked for them....

holygeek
  • 15,653
  • 1
  • 40
  • 50
Woody2143
  • 443
  • 1
  • 4
  • 9