Dancer2::Test appears to misbehave
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
On 12/03/13 10:19 PM, Jashank Jeremy wrote:
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.
When Dancer2::Test is imported, it expects an arrayref of app names. i.e. use Dancer2::Test apps => ['TestApp']; Otherwise it falls back to the caller as the only app to be tested. HTH, Russell. -- Russell Jenkins ("veryrusty")
On Wed, Mar 13, 2013 at 12:07:14AM +1100, Russell Jenkins wrote:
When Dancer2::Test is imported, it expects an arrayref of app names. i.e. use Dancer2::Test apps => ['TestApp'];
Yes, I spoted that; see line 42 of https://gist.github.com/5140883
Otherwise it falls back to the caller as the only app to be tested.
Ah, right; that would seem to explain the way that t/dancer-test.t works. Cheers, ~jashank -- Jashank Jeremy PGP: 0x25A5C309
participants (2)
-
Jashank Jeremy -
Russell Jenkins