call inflate_result on new_result, but not from the CDBI compat layer
[dbsrgits/DBIx-Class.git] / t / row / inflate_result.t
index c31d804..370c205 100644 (file)
@@ -2,6 +2,7 @@ package My::Schema::Result::User;
 
 use strict;
 use warnings;
+use DBIx::Class::ResultClass::HashRefInflator;
 use base qw/DBIx::Class::Core/;
 
 ### Define what our admin class is, for ensure_class_loaded()
@@ -20,6 +21,7 @@ __PACKAGE__->set_primary_key('user_id');
 sub inflate_result {
     my $self = shift;
     my $ret  = $self->next::method(@_);
+    
     if ( $ret->admin ) {    ### If this is an admin, rebless for extra functions
         $self->ensure_class_loaded($admin_class);
         bless $ret, $admin_class;
@@ -61,6 +63,7 @@ package main;
 
 use lib qw(t/lib);
 use DBICTest;
+use DBIx::Class::ResultClass::HashRefInflator;
 
 use Test::More;
 
@@ -84,10 +87,12 @@ ok(
     )
 );
 
+my $rs = $schema->resultset('User');
+
 TODO: {
     local $TODO = 'New objects should also be inflated';
-    my $user  = $schema->resultset('User')->create($user_data);
-    my $admin = $schema->resultset('User')->create($admin_data);
+    my $user  = $rs->create($user_data);
+    my $admin = $rs->create($admin_data);
 
     is( ref $user,  'My::Schema::Result::User' );
     is( ref $admin, 'My::Schema::Result::User::Admin' );