The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Mojo::Role::PSGI - Test PSGI apps using Test::Mojo

SYNOPSIS

  use strict;
  use warnings;

  use Test::More;
  use Test::Mojo::WithRoles 'PSGI';

  my $t = Test::Mojo::WithRoles->new('path/to/app.psgi');

  $t->get_ok('/some/path')
    ->status_is(200)
    ->content_type_like(qr/html/)
    ->text_is('.some-class:nth-child(5)' => 'content of 5th some-class');

  ...

  done_testing;

DESCRIPTION

Test::Mojo makes testing Mojolicious applications easy and fun. Wouldn't it be nice if there was some way to use it for non-Mojolicious apps? Test::Mojo::Role::PSGI does just that.

The author suggests using Test::Mojo::WithRoles to make instances of the tester with (possibly multiple) roles applied in a sane way.

OVERRIDES

new

Overrides the "new" in Test::Mojo method to instantiate a PSGI app IF the argument to new is a string and not empty or an app instance. This should feel very similar to the original behavior except that now PSGI apps are instantiated rather than Mojolicious apps.

SEE ALSO

Test::Mojo
Mojolicious
Mojolicious::Plugin::MountPSGI
Role::Tiny
Test::Mojo::WithRoles

SOURCE REPOSITORY

http://github.com/jberger/Test-Mojo-Role-PSGI

AUTHOR

Joel Berger, <joel.a.berger@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2015 by Joel Berger

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.