Fix the header in MouseX::Types
[gitmo/Mouse.git] / t / 501_moose_coerce_mouse.t
index dc8edde..1d8cc19 100644 (file)
@@ -22,12 +22,12 @@ use Test::Exception;
     use Mouse;
     use Mouse::TypeRegistry;
 
-    subtype 'HeadersType' => sub { defined $_ && eval { $_->isa('Headers') } };
-    coerce 'HeadersType' => +{
-        HashRef => sub {
+    subtype 'HeadersType' => where { defined $_ && eval { $_->isa('Headers') } };
+    coerce  'HeadersType' =>
+        from 'HashRef' => via {
             Headers->new(%{ $_ });
         },
-    };
+    ;
 
     has headers => (
         is     => 'rw',
@@ -43,10 +43,14 @@ use Test::Exception;
 }
 
 {
+    local $TODO = "Doesn't work in the constructor yet?";
     my $r = Mosponse->new(headers => { foo => 'bar' });
-    local our $TODO = "Moose not yet aware of Mouse meta";
     isa_ok($r->headers, 'Headers');
     is(eval{$r->headers->foo}, 'bar');
+}
+
+{
+    my $r = Mosponse->new;
     $r->headers({foo => 'yay'});
     isa_ok($r->headers, 'Headers');
     is($r->headers->foo, 'yay');