X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F800_shikabased%2F002-coerce_multi_class.t;h=0e2d9039e6ed8bb03afbda5486040e8ebfbbe3c2;hb=9b9e4b6566015d6d6e2aa6c745644174efa74623;hp=87450fe60b1298305190fdfc5aad6253aa6d3e05;hpb=3fa6f35df998618abdf763f4e4a060ba8f450a35;p=gitmo%2FMouse.git diff --git a/t/800_shikabased/002-coerce_multi_class.t b/t/800_shikabased/002-coerce_multi_class.t index 87450fe..0e2d903 100644 --- a/t/800_shikabased/002-coerce_multi_class.t +++ b/t/800_shikabased/002-coerce_multi_class.t @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 13; { package Response::Headers; @@ -38,7 +38,7 @@ eval { type 'Headers' => where { defined $_ && eval { $_->isa('Request::Headers') } }; }; -like $@, qr/The type constraint 'Headers' has already been created, cannot be created again in Request/; +like $@, qr/The type constraint 'Headers' has already been created in Response and cannot be created again in Request/; eval { package Request; @@ -68,13 +68,13 @@ eval { package Request; use Mouse::Util::TypeConstraints; - coerce 'Headers' => - from 'HashRefa' => via { - Request::Headers->new(%{ $_ }); + coerce 'Int' => + from 'XXX' => via { + 1 }, ; }; -like $@, qr/Could not find the type constraint \(HashRefa\) to coerce from/; +like $@, qr/Could not find the type constraint \(XXX\) to coerce from/; eval { package Request; @@ -88,12 +88,6 @@ eval { }; ok !$@; -eval { - package Response; - type 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } }; -}; -like $@, qr/The type constraint 'Headers' has already been created, cannot be created again in Response/; - { package Request; use Mouse; @@ -105,7 +99,6 @@ like $@, qr/The type constraint 'Headers' has already been created, cannot be cr ); } - my $req = Request->new(headers => { foo => 'bar' }); isa_ok($req->headers, 'Response::Headers'); is($req->headers->foo, 'bar'); @@ -119,3 +112,4 @@ is($res->headers->foo, 'bar'); $res->headers({foo => 'yay'}); isa_ok($res->headers, 'Response::Headers'); is($res->headers->foo, 'yay'); +