Role to add some extra methods to Test::Mojo for testing routes' HTTP status codes
use Test::More; use Test::Mojo::WithRoles qw(HTTPstatus); my $t = Test::Mojo::WithRoles->new('MyApp'); $t->get_ok('/success')->status_like(qr/^2/); $t->get_ok('/failure')->status_is_error(); done_testing();
status_like does most of the work behind the scenes. For completeness, its opposite
status_unlike is also provided.
$t = $t->status_like(qr/^4/); $t = $t->status_like(qr/^4/, 'some kind of error');
Pass if the status matches a given regex.
$t = $t->status_unlike(qr/^3/); $t = $t->status_unlike(qr/^3/, 'not any kind of redirect');
Pass if the status does not match the given regex.
status_is_* methods match the
is_* methods in Mojo::Message::Response.
None known, plenty lurking no doubt. Please report any bugs that you find on Github:
or even better, raise a pull request that fixes it. The best pull requests include at least two commits, the first being a test that fails, and then in the following commits a code change that makes that test pass, and documentation. I realise that it is difficult to work in that manner, but
git rebase -i will let you edit history to pretend that's what you did.
Copyright 2020 David Cantrell <firstname.lastname@example.org>
This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.
This module is also free-as-in-mason software.