ocharles/Test-Magpie — pull request #1 by stevenl (2013-06-27 02:34:11+00:00)
Title: Enable calling ref() on mock object to return a specified type

The need for this change arose because my module code calls `ref()` on the objects that are mocked during testing.

This change enables you to do the following:

my $obj1 = mock('My::Module');
is ref($obj), 'My::Module', 'instead of Test::Module::Mock';

my $obj2 = mock;
is ref($obj2), 'Test::Magpie::Mock', 'same behaviour as before';

The main changes included:
- Using `UNIVERSAL::ref` in `Test::Magpie::Mock` so I could supply it with a `ref` method that would return a custom ref value.
- The ref value comes from a new attribute `blessed` which is assigned the value that is passed to `mock()`.
- The existing `isa` and `does` methods interfered with `UNIVERSAL::ref`, so I had to add a conditional check in them to handle that.
- I added some tests for `ref`, `isa` and `does`.