-
Notifications
You must be signed in to change notification settings - Fork 4
Dancer::Test thoughts
These are my thoughts so far. Some of my comments are probably due to lack of knowledge on my part and some are maybe just plain silly/unreasonable but here we go...
Note from racke: We replaced Dancer2::Test in Dancer2 with Plack::Test and I expect the same will happen in Dancer1 one as well.
in Dancer.pm we have
sub _init_script_dir {
...
# in bin/ or public/ or t/ we need to go one level upper to find the appdir
$LAYOUT_PRE_DANCER_1_2 = 0
if ($script_dirs[$#script_dirs - 1] eq 'bin')
or ($script_dirs[$#script_dirs - 1] eq 'public')
or ($script_dirs[$#script_dirs - 1] eq 't');
Somehow when shop_cart first gets called the above code path gets hit and so if our tests live directly below 't' then appdir gets reset and following tests fail since views has also changed and so our views cannot be found.
Trying to set config for this plugin inside the test script fails - the config just gets ignored. Gets very confusing when you think you have no_default_pages: 1 but you get the default pages after all.
Getting everything ordered correctly to setup your test app before running the first test is critical. One silly change and your test script blows up.
See the DPIC6 route test commit to see the end result.