Index: t/03crosstable_leak.t
===================================================================
--- t/03crosstable_leak.t (revision 0)
+++ t/03crosstable_leak.t (revision 0)
@@ -0,0 +1,44 @@
+#! /usr/bin/perl -w
+
+use strict;
+use warnings;
+use Test::More tests => 5;
+use Digest;
+
+use File::Spec;
+use FindBin '$Bin';
+use lib File::Spec->catdir( $Bin, 'lib' );
+
+#1
+use_ok("DigestTest");
+
+# ABOUT THIS TEST;
+#
+# TableA is not encoded.
+# TableB is encoded.
+#
+# Both share a field with the same name.
+#
+# This test is to demonstrate, that one is inheriting the encoding options wrongly from the other.
+#
+
+my $schema = DigestTest->init_schema;
+my $tablea = $schema->resultset('TableA');
+my $tableb = $schema->resultset('TableB');
+
+my $objecta = $tablea->create( { conflicting_name => 'foo' } );
+my $objectb = $tableb->create( { conflicting_name => 'bar' } );
+
+is( $objecta->conflicting_name, 'foo', 'Table requested to not be encoded is not encoded' );
+unlike( $objectb->conflicting_name, qr/^(bar|foo)$/, 'Table requested to be encoded is encoded' );
+
+is( $objecta->can('check_conflict'), undef, 'Table that is requested to not be encoded has no check_conflict method' );
+ok( $objectb->can('check_conflict'), 'Table that is requested encoded has check_conflict method' );
+
+END {
+
+ # In the END section so that the test DB file gets closed before we attempt to unlink it
+ DigestTest::clear($schema);
+}
+
+1;
Index: t/lib/DigestTest/Schema/TableA.pm
===================================================================
--- t/lib/DigestTest/Schema/TableA.pm (revision 0)
+++ t/lib/DigestTest/Schema/TableA.pm (revision 0)
@@ -0,0 +1,25 @@
+package # hide from PAUSE
+ DigestTest::Schema::TableA;
+
+use base qw/DBIx::Class/;
+
+__PACKAGE__->load_components(qw/EncodedColumn Core/);
+__PACKAGE__->table('tablea');
+__PACKAGE__->add_columns(
+ id => {
+ data_type => 'int',
+ is_nullable => 0,
+ is_auto_increment => 1
+ },
+ conflicting_name => {
+ data_type => 'char',
+ size => 43,
+ encode_column => 0,
+ encode_class => 'Digest',
+ encode_check_method => 'check_conflict',
+ },
+);
+
+__PACKAGE__->set_primary_key('id');
+
+1;
Index: t/lib/DigestTest/Schema/TableB.pm
===================================================================
--- t/lib/DigestTest/Schema/TableB.pm (revision 0)
+++ t/lib/DigestTest/Schema/TableB.pm (revision 0)
@@ -0,0 +1,25 @@
+package # hide from PAUSE
+ DigestTest::Schema::TableB;
+
+use base qw/DBIx::Class/;
+
+__PACKAGE__->load_components(qw/EncodedColumn Core/);
+__PACKAGE__->table('tableb');
+__PACKAGE__->add_columns(
+ id => {
+ data_type => 'int',
+ is_nullable => 0,
+ is_auto_increment => 1
+ },
+ conflicting_name => {
+ data_type => 'char',
+ size => 43,
+ encode_column => 1,
+ encode_class => 'Digest',
+ encode_check_method => 'check_conflict',
+ },
+);
+
+__PACKAGE__->set_primary_key('id');
+
+1;
Index: t/lib/DigestTest/Schema.pm
===================================================================
--- t/lib/DigestTest/Schema.pm (revision 7824)
+++ t/lib/DigestTest/Schema.pm (working copy)
@@ -3,6 +3,6 @@
use base qw/DBIx::Class::Schema/;
-__PACKAGE__->load_classes(qw/Test/);
+__PACKAGE__->load_classes(qw/Test TableA TableB/);
1;