separate MC failing test
[dbsrgits/DBIx-Class.git] / t / 39load_namespaces_rt41083.t
index facb70f..ba99fe5 100644 (file)
@@ -6,7 +6,13 @@ use Test::More;
 
 use lib 't/lib';
 
-plan tests => 2;
+plan tests => 4;
+
+sub _chk_warning {
+       defined $_[0]? 
+               $_[0] !~ qr/We found ResultSet class '([^']+)' for '([^']+)', but it seems that you had already set '([^']+)' to use '([^']+)' instead/ :
+               1
+}
 
 my $warnings;
 eval {
@@ -14,14 +20,23 @@ eval {
     package DBICNSTest::RtBug41083;
     use base 'DBIx::Class::Schema';
     __PACKAGE__->load_namespaces(
+       result_namespace => 'Schema_A',
+       resultset_namespace => 'ResultSet_A',
+       default_resultset_class => 'ResultSet'
+    );
+};
+ok(!$@) or diag $@;
+ok(_chk_warning($warnings), 'expected no complaint');
+
+eval {
+    local $SIG{__WARN__} = sub { $warnings .= shift };
+    package DBICNSTest::RtBug41083;
+    use base 'DBIx::Class::Schema';
+    __PACKAGE__->load_namespaces(
        result_namespace => 'Schema',
        resultset_namespace => 'ResultSet',
        default_resultset_class => 'ResultSet'
     );
 };
 ok(!$@) or diag $@;
-ok(
-       $warnings !~
-       qr/We found ResultSet class '([^']+)' for '([^']+)', but it seems that you had already set '([^']+)' to use '([^']+)' instead/,
-       'Proxy sub class did not generate an error'
-);
+ok(_chk_warning($warnings), 'expected no complaint') or diag $warnings;