Do a bit of fixing. instance and new are one and the same. More tests to ensure that...
[gitmo/MooseX-Singleton.git] / t / singleton.t
1 use Test::More tests => 4;
2
3 use strict;
4 use warnings;
5
6 {
7     package Foo::Singleton;
8     use Moose;
9
10     with qw/MooseX::Singleton/;
11
12     has gravy => (is => 'rw');
13 }
14
15 my $ante = Foo::Singleton->instance;
16
17 ok(Foo::Singleton->new,'new');
18
19 my $foo = Foo::Singleton->instance;
20 my $bar = Foo::Singleton->instance;
21 my $baz = Foo::Singleton->new;
22
23 $foo->gravy('sauce');
24
25 is($bar->gravy,'sauce','singleton');
26 is($baz->gravy,'sauce','singleton');
27 is($ante->gravy,'sauce','singleton');
28