[dancer-users] Dancer2::Test appears to misbehave

Jashank Jeremy jashank at rulingia.com
Tue Mar 12 11:19:26 GMT 2013


G'day,

I asked this on IRC, but I've not seen a response yet:

If we have a very simple Dancer 2 application, consisting of the
single route:

    get '/' => sub {
        "test reference 1";
    };

If, then, Dancer2::Test is set up (in a separate package) and we call
`response_content_is`

    response_content_is ([GET => '/'], "test reference 1");

the test does not pass: it _always_ fails, for reasons I don't quite
grasp.

If I turn on `DANCER_DEBUG_CORE` in the environment, it's obvious
that the app is being configured correctly, and in fact, if we were to
simply tell the application to dance, it would.

This suggests, to me, that the bug is somewhere in Dancer2::Core.  But I
have no idea what the flow of routes and requests is, so I cannot (yet)
suggest a solution.

In the meantime, it looks suspiciously like Dancer2::Test is broken.  I
ran the Dancer2 test suite, which includes tests for Dancer2::Test, and,
while it doesn't find any errors, I'm not convinced that the test code
tests Dancer2::Test correctly.

I'm not entirely sure how to proceed from here.  Certainly, I'd like to
know why `response_content_is` isn't actually handling responses
correctly except in the test suite code, which suggests that it's a
property of the way the routes are constructed in the test code -- and
that really isn't helpful.

I've got the full code and essentially all of these notes up on Github
at https://gist.github.com/Jashank/5140883

Cheers,

Jashank

--
Jashank Jeremy
PGP: 0x25A5C309

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 235 bytes
Desc: not available
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20130312/aad48cac/attachment.pgp>


More information about the dancer-users mailing list