From: Amiri Barksdale at Home <amiri@roosterpirates.com>
Date: Wed, 5 Oct 2011 07:21:17 +0000 (-0700)
Subject: Add test for non-signatures namespace cleaning
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63420f8cd12512d1c06be1dd0a04c8943e92befc;p=dbsrgits%2FDBIx-Class-ResultSource-MultipleTableInheritance.git

Add test for non-signatures namespace cleaning
---

diff --git a/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm b/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm
index ab5c7d3..dbe0f75 100644
--- a/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm
+++ b/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm
@@ -9,7 +9,7 @@ use aliased 'DBIx::Class::ResultSource::Table';
 use aliased 'DBIx::Class::ResultClass::HashRefInflator';
 use String::TT qw(strip tt);
 use Scalar::Util qw(blessed);
-use namespace::autoclean;
+use namespace::autoclean -also => [qw/argify qualify_with body_cols pk_cols names_of function_body arg_hash rule_body/];
 
 our $VERSION = 0.01;
 
@@ -250,7 +250,7 @@ method add_relationship ($name, $f_source, $cond, $attrs) {
 }
 
 BEGIN {
-
+  # Helper methods
   sub argify {
     my @names = @_;
     map '_' . $_, @names;
@@ -294,9 +294,6 @@ BEGIN {
       $function$ LANGUAGE plpgsql;
     };
   }
-}
-
-BEGIN {
 
   sub arg_hash {
     my $source = shift;
diff --git a/t/05_namespace.t b/t/05_namespace.t
new file mode 100644
index 0000000..40e2f60
--- /dev/null
+++ b/t/05_namespace.t
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+use lib 't/lib';
+use LoadTest;
+use Test::More qw(no_plan);
+use Devel::Dwarn;
+
+my $mti = LoadTest->source('Foo');
+
+isa_ok( $mti, "DBIx::Class::ResultSource::MultipleTableInheritance" );
+
+can_ok( $mti,
+    qw/new add_additional_parents add_additional_parent _source_by_name schema attach_additional_sources set_primary_key set_sequence raw_source_name raw_table_name add_columns add_relationship/
+);
+
+ok( !$mti->can($_), "My helper method $_ was removed" )
+    for
+    qw/argify qualify_with body_cols pk_cols names_of function_body arg_hash rule_body/;
+