fix ::DBI::Replicated::all_storages
Rafael Kitover [Wed, 6 May 2009 03:13:56 +0000 (03:13 +0000)]
lib/DBIx/Class/Storage/DBI/Replicated.pm
t/93storage_replication.t

index 59e74dc..a25b2a4 100644 (file)
@@ -412,7 +412,7 @@ sub all_storages {
   my $self = shift @_;
   return grep {defined $_ && blessed $_} (
      $self->master,
-     $self->replicants,
+     values %{ $self->replicants },
   );
 }
 
index 422a445..f6d2be6 100644 (file)
@@ -10,7 +10,7 @@ BEGIN {
     eval "use DBIx::Class::Storage::DBI::Replicated; use Test::Moose";
     plan $@
         ? ( skip_all => "Deps not installed: $@" )
-        : ( tests => 79 );
+        : ( tests => 82 );
 }
 
 use_ok 'DBIx::Class::Storage::DBI::Replicated::Pool';
@@ -223,6 +223,15 @@ ok my @replicant_connects = $replicated->generate_replicant_connect_info
 
 ok my @replicated_storages = $replicated->schema->storage->connect_replicants(@replicant_connects)
     => 'Created some storages suitable for replicants';
+
+ok my @all_storages = $replicated->schema->storage->all_storages
+    => '->all_storages';
+
+ok @all_storages == 3
+    => 'correct number of ->all_storages';
+
+ok ((grep $_->isa('DBIx::Class::Storage::DBI'), @all_storages) == 3
+    => '->all_storages are correct type');
  
 my @replicant_names = keys %{ $replicated->schema->storage->replicants };