switched to using _with_meta_key and _with_meta_hash
[dbsrgits/DBIx-Class-ResultSet-WithMetaData.git] / t / custom_methods.t
index 9db7886..1fd689d 100644 (file)
@@ -27,7 +27,31 @@ ok(my $schema = DBICTest->init_schema(), 'got schema');
 }
 
 {
-       my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr->display();
+       my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_multi->display();
+       is_deeply($artists, [
+               {
+                       'artistid' => '1',
+                       'name' => 'Caterwauler McCrae',
+                       'substr' => 'Cat',
+                       'substr2' => 'Cate'
+               },
+               {
+                       'artistid' => '2',
+                       'name' => 'Random Boy Band',
+                       'substr' => 'Ran',
+                       'substr2' => 'Rand'
+               },
+               {
+                       'artistid' => '3',
+                       'name' => 'We Are Goth',
+                       'substr' => 'We ',
+                       'substr2' => 'We A'
+               }
+       ], 'display with substring using _with_meta_hash okay');
+}
+
+{
+       my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_key->display();
        is_deeply($artists, [
                {
                        'artistid' => '1',
@@ -44,7 +68,7 @@ ok(my $schema = DBICTest->init_schema(), 'got schema');
                        'name' => 'We Are Goth',
                        'substr' => 'We '
                }
-       ], 'display with substring okay');
+       ], 'display with substring using _with_meta_key okay');
 }
 
 # {
@@ -69,7 +93,7 @@ ok(my $schema = DBICTest->init_schema(), 'got schema');
 # }
 
 {
-       my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr->search({}, { prefetch => 'cds', rows => 1 })->display();
+       my $artists = $schema->resultset('Artist')->search({}, { order_by => 'artistid' })->with_substr_key->search({}, { prefetch => 'cds', rows => 1 })->display();
        is_deeply($artists, [
       { 
         'artistid' => 1,