Coerce a type that won't fail us later (damn you Moose)
[gitmo/Mouse.git] / t / 800_shikabased / 002-coerce_multi_class.t
index 2bfd2d2..b2d26b8 100644 (file)
@@ -18,7 +18,7 @@ use Test::More tests => 14;
     use Mouse;
     use Mouse::Util::TypeConstraints;
 
-    subtype 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } };
+    type 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } };
     coerce 'Headers' =>
         from 'HashRef' => via {
             Response::Headers->new(%{ $_ });
@@ -36,9 +36,9 @@ eval {
     package Request;
     use Mouse::Util::TypeConstraints;
 
-    subtype 'Headers' => where { defined $_ && eval { $_->isa('Request::Headers') } };
+    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;
@@ -90,9 +90,9 @@ ok !$@;
 
 eval {
     package Response;
-    subtype 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } };
+    type 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } };
 };
-like $@, qr/The type constraint 'Headers' has already been created, cannot be created again in Response/;
+like $@, qr/The type constraint 'Headers' has already been created in Response and cannot be created again in Response/;
 
 {
     package Request;