fix loading connect_info from schema-defined connection (RT 48084)
Aran Deltac [Wed, 22 Jul 2009 16:16:42 +0000 (16:16 +0000)]
Changes
lib/Catalyst/Model/DBIC/Schema.pm
t/07connect_info.t

diff --git a/Changes b/Changes
index c07873f..d885aac 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for Perl extension Catalyst::Model::DBIC::Schema
 
 0.26  As yet unreleased
+    - fix loading connect_info from schema-defined connection (RT 48084)
     - Fix missing dep on Catalyst::Helper that made tests fail (RT 47449)
 
 0.25  Fri Jun 19 08:35:38 PDT 2009
index dece52f..cfdb5e4 100644 (file)
@@ -442,7 +442,7 @@ has schema_class => (
 
 has storage_type => (is => 'rw', isa => Str);
 
-has connect_info => (is => 'ro', isa => ConnectInfo, coerce => 1);
+has connect_info => (is => 'rw', isa => ConnectInfo, coerce => 1);
 
 has model_name => (
     is => 'ro',
index 0e0ed70..e49dba1 100644 (file)
@@ -47,7 +47,7 @@ my @invalid = (
         { pg_enable_utf8 => 1 }, { AutoCommit => 1 }, { auto_savepoint => 1 }],
 );
 
-plan tests => @tests / 2 + @invalid + 1;
+plan tests => @tests / 2 + @invalid + 1 + 1;
 
 # ignore redefined warnings, and uninitialized warnings from old
 # ::Storage::DBI::Replicated
@@ -88,6 +88,14 @@ is_deeply $m->replicants, [
     map $tests[$_], grep $_ % 2, 0 .. $#tests
 ], 'replicant connect_infos coerced correctly';
 
+{
+    ASchemaClass->connection( @{$tests[0]} );
+    my $m = instance();
+
+    is_deeply $m->connect_info, $tests[1],
+        'connect_info coerced correctly when defining connection in the schema class';
+}
+
 sub instance {
     Catalyst::Model::DBIC::Schema->new({
         schema_class => 'ASchemaClass',