Add exercises for section 2
[gitmo/moose-presentations.git] / moose-class / exercises / t / 02-roles.t
1 # Your tasks ...
2 #
3 # Create a Printable role. This role should simply require that the
4 # consuming class implement an "as_string" method.
5 #
6 # Make the Person class from the last set of exercises consume this
7 # role. Use printable_name as the output for the as_string method. The
8 # Employee subclass should still override this output.
9 #
10 # Implement a role HasMoney. This should provide a read-write
11 # "balance" attribute. It should also implement "deposit" and
12 # "withdraw" methods. Attempting to reduce the cash balance below 0
13 # via "withdraw" should die with an error that includes the string:
14 #
15 #  Balance cannot be negative
16 #
17 # Make the Person class consumes this role as well.
18 #
19 # Make sure all roles are free of Moose droppings.
20
21 use strict;
22 use warnings;
23
24 use lib 't/lib';
25
26 use MooseClass::Tests;
27
28 use Person;
29 use Employee;
30
31 MooseClass::Tests::tests02();