PerlDancer/Dancer2 — pull request #449 by gideondsouza (2013-09-09 18:29:11+00:00)
Title: Pr/test session hooks

So as requested in issue #383 this is a test suite to test all session hooks.

I've mostly stolen ideas from hooks.t and session_engines.t. This suite has gone through a couple of iterations.

Initially I tried to write the suite with Dancer2::Test, which doesn't workout for sessions in the dancer2 test app. I then tried using Test::TCP, which ensures that the sessions work but there isn't (possibly) a way for me to find out whether a hook ran or not since the app and the test client run in separate processes.

Finally after a discussion with @ambs and @mst I used LWP::Protocol::PSGI to run the dancer2 app and test it from the same process.

NOTE: I tried to abstract the test so that I could use the same code for the Simple backend and then for YAML. Currently as it stands if you update `my @engines = qw(YAML)` it actually works. But if you do TWO engines together `@engines = qw(Simple YAML)` the second test fails. It's always the second test no matter what order you put it in.

I would like to have this reviewed and I can go through another around and perfect it as per any comments :)