NAME Test::Moose::More - More tools for testing Moose packages VERSION This document describes version 0.023 of Test::Moose::More - released January 21, 2014 as part of Test-Moose-More. SYNOPSIS use Test::Moose::More; is_class 'Some::Class'; is_role 'Some::Role'; has_method_ok 'Some::Class', 'foo'; # ... etc DESCRIPTION This package contains a number of additional tests that can be employed against Moose classes/roles. It is intended to replace Test::Moose in your tests, and re-exports any tests that it has and we do not, yet. FUNCTIONS known_sugar Returns a list of all the known standard Moose sugar (has, extends, etc). TEST_FUNCTIONS meta_ok $thing Tests $thing to see if it has a metaclass; $thing may be the class name or instance of the class you wish to check. does_ok $thing, < $role | \@roles >, [ $message ] Checks to see if $thing does the given roles. $thing may be the class name or instance of the class you wish to check. Note that the message will be taken verbatim unless it contains %s somewhere; this will be replaced with the name of the role being tested for. does_not_ok $thing, < $role | \@roles >, [ $message ] Checks to see if $thing does not do the given roles. $thing may be the class name or instance of the class you wish to check. Note that the message will be taken verbatim unless it contains %s somewhere; this will be replaced with the name of the role being tested for. has_attribute_ok $thing, $attribute_name, [ $message ] Checks $thing for an attribute named $attribute_name; $thing may be a class name, instance, or role name. has_method_ok $thing, @methods Queries $thing's metaclass to see if $thing has the methods named in @methods. requires_method_ok $thing, @methods Queries $thing's metaclass to see if $thing requires the methods named in @methods. Note that this really only makes sense if $thing is a role. is_role $thing Passes if $thing's metaclass is a Moose::Meta::Role. is_class $thing Passes if $thing's metaclass is a Moose::Meta::Class. is_anon $thing Passes if $thing is "anonymous". is_not_anon $thing Passes if $thing is not "anonymous". check_sugar_removed_ok $thing Ensures that all the standard Moose sugar is no longer directly callable on a given package. check_sugar_ok $thing Checks and makes sure a class/etc can still do all the standard Moose sugar. validate_thing Runs a bunch of tests against the given $thing, as defined: validate_class $thing => ( attributes => [ ... ], methods => [ ... ], isa => [ ... ], # ensures $thing does these roles does => [ ... ], # ensures $thing does not do these roles does_not => [ ... ], ); $thing can be the name of a role or class, an object instance, or a metaclass. validate_role The same as validate_thing(), but ensures $thing is a role, and allows for additional role-specific tests. validate_role $thing => ( required_methods => [ ... ], # ...and all other options from validate_thing() validate_class The same as validate_thing(), but ensures $thing is a class, and allows for additional class-specific tests. validate_attribute validate_attribute() allows you to test how an attribute looks once built and attached to a class. Let's say you have an attribute defined like this: has foo => ( traits => [ 'TestRole' ], is => 'ro', isa => 'Int', builder => '_build_foo', lazy => 1, ); You can use validate_attribute() to ensure that it's built out in the way you expect: validate_attribute TestClass => foo => ( -does => [ 'TestRole' ], -isa => [ 'Moose::Meta::Attribute' ], # for demonstration's sake traits => [ 'TestRole' ], isa => 'Int', does => 'Bar', handles => { }, reader => 'foo', builder => '_build_foo', default => undef, init_arg => 'foo', lazy => 1, required => undef, ); Not yet documented or tested exhaustively; please see t/validate_attribute.t for details at the moment. This test routine is likely to change in implementation and scope, with every effort to maintain backwards compatibility. attribute_options_ok Validates that an attribute is set up as expected; like validate_attribute(), but only concerns itself with attribute options. Not yet documented or tested exhaustively; please see t/validate_attribute.t for details at the moment. This test routine is likely to change in implementation and scope, with every effort to maintain backwards compatibility. SEE ALSO Please see those modules/websites for more information related to this module. * Test::Moose SOURCE The development version is on github at and may be cloned from BUGS Please report any bugs or feature requests on the bugtracker website https://github.com/RsrchBoy/Test-Moose-More/issues When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHOR Chris Weyl CONTRIBUTOR Karen Etheridge COPYRIGHT AND LICENSE This software is Copyright (c) 2012 by Chris Weyl. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999