[Catalyst] Mocking PSGI layers in Test WWW Mechanize Catalyst
toby at dryft.net
Mon Nov 4 00:07:47 GMT 2013
On 2 November 2013 02:39, John Napiorkowski <jjn1056 at yahoo.com> wrote:
> Catalyst::Test uses Plack::Test under the hood. That mangle_response stuff
> is mostly evil :)
> Sounds like you are saying you'd like to apply Plack Middleware during
> testing. The latest dev release on CPAN lets you configure middleware via
> configuration, so you could have some middleware in your test configuration.
> This use case is one of the reasons I added this feature, so that we could
> manage middleware for catalyst inside of catalyst configuration.
That's correct -- I'd like to apply some plack middleware, which is a
mocked-up-for-testing version of some middleware we run in production.
Since the app now depends upon it, being able to specify it in the
catalyst config would be fine.
> If you don't like that approach, I could be talked into a patch to
> Catalyst::Test that would let you declare additional middleware in the test
> I'd prefer this over messing with Catalyst::Test internals. One of the hard
> things about trying to move Catalyst forward is that we've expose a ton of
> API that we fear to change since we don't know who is overriding what in the
> Darkpan. Ideally I'd like to see people use Plack Middleware for jobs
> involving modifying the request and response, since that is something its
> great at, and the API is just a code ref, so its very well decoupled (could
> even be used outside of Catalyst).
Thanks John. I'll keep an eye out for the new release! (but will be
hacking up something nasty and temporary until then so I can get some
unit tests passing again..)
More information about the Catalyst