[dancer-users] Testing with Dancer2::Test, configuration, settings, sessions, etc.

Jeff Boes jeff at endpoint.com
Wed May 29 14:41:28 BST 2013


I am attempting to convert my test scripts (using Test::More and Dancer::Test) over to Dancer2. There seems to be a
fundamental difference in the way the configuration, settings, and session info is constructed and accessed. I am hoping
someone on the list can comment to push me in the right direction.

In my test script, I have --

use My::App::Routes;
use Dancer2;
use Dancer2::Test apps => ['My::App::Routes'];
...
set('current_date' => '2013-05-06');
$response = dancer_response GET => '/my/app/foo/';

The Perl debugger confirms that setting('current_date') returns the value I expect just before this last line is executed.

In the route handler, I have something like:

my $stuff = My::App::Stuff::get_stuff(setting('current_date'));

Perl debugger shows setting('current_date') is undefined. How do I get these to communicate?

-- 
Jeff Boes <><
jeff at endpoint.com
269-408-0811


More information about the dancer-users mailing list