[Bps-public-commit] Prophet branch, master, updated. 0.69_01-29-ged7dccb

spang at bestpractical.com spang at bestpractical.com
Tue Sep 1 23:33:08 EDT 2009


The branch, master has been updated
       via  ed7dccb4609470f862122cbb49bbd2e50c57d830 (commit)
      from  8c1cd05061a300a0d2f43a01350730164a29e7e9 (commit)

Summary of changes:
 lib/Prophet/CLI/Command/Push.pm |    2 ++
 t/error.t                       |   31 +++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 t/error.t

- Log -----------------------------------------------------------------
commit ed7dccb4609470f862122cbb49bbd2e50c57d830
Author: Christine Spang <spang at bestpractical.com>
Date:   Tue Sep 1 23:29:17 2009 -0400

    Better error message when pushing to non-existant replica

diff --git a/lib/Prophet/CLI/Command/Push.pm b/lib/Prophet/CLI/Command/Push.pm
index d4f6e9e..892680d 100644
--- a/lib/Prophet/CLI/Command/Push.pm
+++ b/lib/Prophet/CLI/Command/Push.pm
@@ -46,6 +46,8 @@ sub run {
         app_handle => $self->app_handle,
     );
 
+    die "No replica found at '".$self->arg('to')."'.\n" unless $class;
+
     die "Can't push to foreign replica that's never been pulled from! (Override with --force.)\n"
         unless
             $class->isa('Prophet::ForeignReplica') &&
diff --git a/t/error.t b/t/error.t
new file mode 100644
index 0000000..2e18fd6
--- /dev/null
+++ b/t/error.t
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+use Prophet::Test tests => 1;
+use File::Temp qw(tempdir);
+
+$ENV{'PROPHET_REPO'} = tempdir( CLEANUP => ! $ENV{PROPHET_DEBUG}  ) . '/repo-' . $$;
+diag "Replica is in $ENV{PROPHET_REPO}";
+
+# testing various error conditions that don't make sense to test anywhere else
+
+my $no_replica = tempdir( CLEANUP => ! $ENV{PROPHET_DEBUG}  ) . '/repo-' . $$;
+my @cmds = (
+    {
+        cmd     => [ 'push', '--to', $no_replica ],
+        error   => [
+            "No replica found at '$no_replica'.",
+            ],
+        comment => 'push to nonexistant replica',
+    },
+);
+
+for my $item ( @cmds ) {
+    my $exp_error
+        = defined $item->{error}
+        ? (join "\n", @{$item->{error}}) . "\n"
+        : '';
+    my ($got_output, $got_error) = run_command( @{$item->{cmd}} );
+    is( $got_error, $exp_error, $item->{comment} );
+}

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list