[Bps-public-commit] SD branch, master, updated. 0d7a4aada69fa9c07ee2bb843deda51a386adff4
spang at bestpractical.com
spang at bestpractical.com
Thu Aug 20 19:50:10 EDT 2009
The branch, master has been updated
via 0d7a4aada69fa9c07ee2bb843deda51a386adff4 (commit)
via 234e43e269c4e941957007de2c1714eed7f230e3 (commit)
from 4f04016383d1d36a54757bf2be5dbfa2807f2234 (commit)
Summary of changes:
lib/App/SD/CLI/Dispatcher.pm | 4 +-
t/no-email.t | 51 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 2 deletions(-)
create mode 100644 t/no-email.t
- Log -----------------------------------------------------------------
commit 234e43e269c4e941957007de2c1714eed7f230e3
Author: Christine Spang <spang at bestpractical.com>
Date: Fri Aug 21 00:23:31 2009 +0100
Better error message for take/claim w/no email set
diff --git a/lib/App/SD/CLI/Dispatcher.pm b/lib/App/SD/CLI/Dispatcher.pm
index ba04bdc..fcbaa1e 100644
--- a/lib/App/SD/CLI/Dispatcher.pm
+++ b/lib/App/SD/CLI/Dispatcher.pm
@@ -159,8 +159,8 @@ under ticket => sub {
$self->context->set_prop(owner => $email);
run('ticket update', $self, @_);
} else {
- die "Could not determine email address to assign ticket to ".
- "(set the 'user.email-address' config variable.)\n";
+ die "Could not determine email address to assign ticket to!\n".
+ "Set the 'user.email-address' config variable.\n";
}
};
commit 0d7a4aada69fa9c07ee2bb843deda51a386adff4
Author: Christine Spang <spang at bestpractical.com>
Date: Fri Aug 21 00:40:48 2009 +0100
Tests for triggering no-email-set error messages
Closes: 0e661c3e-8817-11de-82eb-f5bd9d918618
diff --git a/t/no-email.t b/t/no-email.t
new file mode 100644
index 0000000..3462d57
--- /dev/null
+++ b/t/no-email.t
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+use Prophet::Test tests => 3;
+use App::SD::Test;
+use App::SD::CLI;
+$Prophet::Test::CLI_CLASS = 'App::SD::CLI';
+
+$ENV{'PROPHET_REPO'} = $Prophet::Test::REPO_BASE . '/repo-' . $$;
+diag "Replica is in $ENV{PROPHET_REPO}";
+
+run_command( 'init', '--non-interactive' );
+is( run_command( 'config', 'user.email-address' ),
+ "Key user.email-address is not set.\n", 'no email set' );
+
+$ENV{PROPHET_EMAIL} = undef;
+$ENV{EMAIL} = undef;
+
+my @cmds = (
+ {
+ cmd => [ 'claim', 'ticket', '1' ],
+ error => [
+ 'Could not determine email address to assign ticket to!',
+ "Set the 'user.email-address' config variable.",
+ ],
+ comment => 'ticket claim w/no email set',
+ },
+ {
+ cmd => [ qw(ticket new -- summary foo) ],
+ error => [
+ 'Cannot determine an email to attribute your changes to. You can',
+ "fix this by setting the config variable 'user.email-address'.",
+ ],
+ comment => 'trigger prop_default_reporter w/no email',
+ },
+);
+
+for my $item ( @cmds ) {
+ my $exp_error
+ = defined $item->{error}
+ ? (join "\n", @{$item->{error}})
+ : '';
+ my ($out, $got_error) = run_command( @{$item->{cmd}} );
+ {
+ local $/ = ""; # chomp paragraph mode
+ chomp $got_error;
+ chomp $exp_error;
+ }
+ is( $got_error, $exp_error, $item->{comment} );
+}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list