-
-
03 Mar 2015 05:05:52 UTC
- Distribution: Test-Mojo-WithRoles
- Module version: 0.02
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (0)
- Testers (4643 / 1 / 0)
- Kwalitee
Bus factor: 1- 85.37% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (3.25KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Joel Berger, E<lt>joel.a.berger@gmail.comE<gt>
NAME
Test::Mojo::WithRoles - Use Test::Mojo roles cleanly and safely
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::WithRoles builds composite subclasses of Test::Mojo based on a lexically specified set of roles. This is easy to use and plays nicely with others.
Of course this is all just sugar for the mechanisms provided by Role::Tiny.
IMPORTING
{ use Test::Mojo::WithRoles qw/MyRole +Test::MyRole/; my $t = Test::Mojo::WithRoles->new('MyApp'); $t->does('Test::Mojo::Role::MyRole'); # true $t->does('Test::MyRole'); # true } my $t = Test::Mojo::WithRoles->new; $t->does('Test::Mojo::Role::MyRole'); # false
Pass a list of roles when you import Test::Mojo::WithRoles. Those roles will be used to construct a subclass of Test::Mojo with those roles when
new
is called within that lexical scope. After leaving that lexical scope, the roles specified are no longer in effect when constructing a new object.Roles specified without a leading
+
sign are assumed to be in theTest::Mojo::Role
namespace. Roles specified with a leading+
sign are used literally as the fully qualified package name.SEE ALSO
SOURCE REPOSITORY
http://github.com/jberger/Test-Mojo-WithRoles
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.
Module Install Instructions
To install Test::Mojo::WithRoles, copy and paste the appropriate command in to your terminal.
cpanm Test::Mojo::WithRoles
perl -MCPAN -e shell install Test::Mojo::WithRoles
For more information on module installation, please visit the detailed CPAN module installation guide.