NAME
Test::Mojo::Role - Roles for Test::Mojo
SYNOPSIS
package Test::Mojo::Role::MyRole;
use Role::Tiny;
sub is_awesome {
my ($t, ...) = @_;
# do some test
}
---
# myapp.t
use Test::More;
use Test::Mojo::WithRoles 'MyRole';
my $t = Test::Mojo::WithRoles->new('MyApp');
$t->get_ok(...)
->is_awesome(...);
done_testing;
DESCRIPTION
Test::Mojo::Role
is not a real module, just documentation. Roles do not inherit from a base, but if they did, this would be the base class for Test::Mojo::Role::
s.
Roles should be built in such a way that they can be applied via Role::Tiny. Roles may actually be applied using Test::Mojo::WithRoles which provides a nice interface to the test author. Your role does not need to depend on Test::Mojo::WithRoles but if it does, the test author will get that module during install.