Ran Eilam > Aspect-0.09_02 > Aspect::Library::TestClass

Download:
Aspect-0.09_02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  1
View/Report Bugs
Source   Latest Release: Aspect-0.12

NAME ^

Aspect::Library::TestClass - give Test::Class test methods an IUT (implementation under test)

SYNOPSIS ^

  # append IUT to params of all test methods in matching packages
  # place this in your test script
  aspect TestClass => call qr/::tests::/;

SUPER ^

Aspect::Modular

DESCRIPTION ^

Frequently my Test::Class test methods look like this:

  sub some_test: Test {
     my $self = shift;
     my $subject = IUT->new;
     # send $subject messages and verify expected results
     ...
  }

After installing this aspect, they look like this:

  sub some_test: Test {
     my ($self, $subject) = @_;
     # send $subject messages and verify expected results
     ...
  }

In the test class you must add one template method to provide the class of the IUT:

  sub subject_class { 'MyApp::Person' }

SEE ALSO ^

See the Aspect pods for a guide to the Aspect module.

XUL-Node tests use this aspect extensively.

syntax highlighting: