Ensure Module::Runtime use_package_optimistically works.
[scpubgit/Object-Remote.git] / xt / load_optional.t
index 2e7f510..fda12a2 100644 (file)
@@ -21,7 +21,10 @@ is exception {
     my $remote = My::Data::TestModuleRuntime->new::on($connection);
     is($remote->counter, 0, 'Counter at 0');
     is($remote->increment, 1, 'Increment to 1');
-    is($remote->has_missing_module, 0, 'Shouldn\'t have loaded module');
+    like exception {
+        my $o = $remote->create_object;
+    }, qr/Can't locate Not\/Found.pm in \@INC/, 'Should fail to load Not::Found';
+
 }, undef, 'Checking Module::Runtime use_package_optimistically works correctly.';
 
 done_testing;
@@ -51,4 +54,4 @@ has counter => (is => 'rwp', default => sub { 0 });
 
 sub increment { $_[0]->_set_counter($_[0]->counter + 1); }
 
-sub has_missing_module { HAS_MISSING_MODULE };
+sub create_object { use_package_optimistically('Not::Found')->new() };