Avoid duplication in running the same tests with and without immutable
[gitmo/Moose.git] / t / 040_type_constraints / 009_union_types_and_coercions.t
index 147859b..69254f5 100644 (file)
@@ -9,12 +9,10 @@ use Test::Exception;
 BEGIN {
     eval "use IO::String; use IO::File;";
     plan skip_all => "IO::String and IO::File are required for this test" if $@;        
-    plan tests => 29;    
+    plan tests => 28;    
 }
 
-BEGIN {
-    use_ok('Moose');           
-}
+
 
 {
     package Email::Moose;
@@ -47,11 +45,15 @@ BEGIN {
         => from 'FileHandle'
             => via { bless $_, 'IO::File' };
     
+    # create the alias
+    
+    subtype 'IO::StringOrFile' => as 'IO::String | IO::File';
+    
     # attributes
     
     has 'raw_body' => (
         is      => 'rw',
-        isa     => 'IO::String|IO::File',
+        isa     => 'IO::StringOrFile',
         coerce  => 1,
         default => sub { IO::String->new() },
     );