[Bps-public-commit] r15345 - in sd/trunk: . lib/App/SD

spang at bestpractical.com spang at bestpractical.com
Thu Aug 21 18:11:18 EDT 2008


Author: spang
Date: Thu Aug 21 18:11:17 2008
New Revision: 15345

Modified:
   sd/trunk/   (props changed)
   sd/trunk/lib/App/SD/Test.pm
   sd/trunk/t/02-create-with-editor.t
   sd/trunk/t/03-update-ticket-with-editor.t
   sd/trunk/t/04-update-ticket-comment-with-editor.t

Log:
 r48822 at loki:  spang | 2008-08-21 23:11:11 +0100
 factor out editor frobbing to App::SD::Test->set_editor


Modified: sd/trunk/lib/App/SD/Test.pm
==============================================================================
--- sd/trunk/lib/App/SD/Test.pm	(original)
+++ sd/trunk/lib/App/SD/Test.pm	Thu Aug 21 18:11:17 2008
@@ -4,6 +4,9 @@
 use strict;
 
 require Prophet::Test;
+use Test::More;
+use File::Spec;
+use Cwd qw/getcwd/;
 use base qw/Exporter/;
 our @EXPORT = qw(create_ticket_ok create_ticket_comment_ok get_uuid_for_luid get_luid_for_uuid);
 
@@ -148,3 +151,20 @@
         [ qr/Updated comment (.*?)(?{ $comment_luid })\s+\((.*)(?{ $comment_uuid })\)/]
     );
 }
+
+=head2 set_editor SCRIPT
+
+Sets the editor that Proc::InvokeEditor uses (which is used for nicer ticket
+and comment creation / update, etc.).
+
+This should be a non-interactive script found in F<t/scripts>.
+
+=cut
+
+sub set_editor {
+    my ($self, $script) = @_;
+
+    undef $ENV{'VISUAL'};       # Proc::InvokeEditor checks this first
+    $ENV{'EDITOR'} = File::Spec->catfile(getcwd(), 't', 'scripts', $script);
+    diag 'export EDITOR=' . $ENV{'EDITOR'} . "\n";
+}

Modified: sd/trunk/t/02-create-with-editor.t
==============================================================================
--- sd/trunk/t/02-create-with-editor.t	(original)
+++ sd/trunk/t/02-create-with-editor.t	Thu Aug 21 18:11:17 2008
@@ -3,16 +3,12 @@
 
 use Prophet::Test tests => 4;
 use App::SD::Test;
-use Cwd;
 
 BEGIN {
     require File::Temp;
     $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
     diag 'export SD_REPO=' . $ENV{'PROPHET_REPO'} . "\n";
-    # frob the editor to use a perl script instead of spawning vi/emacs/etc.
-    undef $ENV{'VISUAL'};       # Proc::InvokeEditor checks this first
-    $ENV{'EDITOR'} = File::Spec->catfile(getcwd(), 't', 'scripts', 'ticket-create-editor.pl');
-    diag 'export EDITOR=' . $ENV{'EDITOR'} . "\n";
+    App::SD::Test->set_editor('ticket-create-editor.pl');
 }
 
 my ($ticket_id, $ticket_uuid, $comment_id, $comment_uuid) = App::SD::Test::create_ticket_with_editor_ok();

Modified: sd/trunk/t/03-update-ticket-with-editor.t
==============================================================================
--- sd/trunk/t/03-update-ticket-with-editor.t	(original)
+++ sd/trunk/t/03-update-ticket-with-editor.t	Thu Aug 21 18:11:17 2008
@@ -3,16 +3,12 @@
 
 use Prophet::Test tests => 5;
 use App::SD::Test;
-use Cwd;
 
 BEGIN {
     require File::Temp;
     $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
     diag 'export SD_REPO=' . $ENV{'PROPHET_REPO'} . "\n";
-    # frob the editor to use a perl script instead of spawning vi/emacs/etc.
-    undef $ENV{'VISUAL'};       # Proc::InvokeEditor checks this first
-    $ENV{'EDITOR'} = File::Spec->catfile(getcwd(), 't', 'scripts', 'ticket-update-editor.pl');
-    diag 'export EDITOR=' . $ENV{'EDITOR'} . "\n";
+    App::SD::Test->set_editor('ticket-update-editor.pl');
 }
 
 # create ticket

Modified: sd/trunk/t/04-update-ticket-comment-with-editor.t
==============================================================================
--- sd/trunk/t/04-update-ticket-comment-with-editor.t	(original)
+++ sd/trunk/t/04-update-ticket-comment-with-editor.t	Thu Aug 21 18:11:17 2008
@@ -3,16 +3,12 @@
 
 use Prophet::Test tests => 5;
 use App::SD::Test;
-use Cwd;
 
 BEGIN {
     require File::Temp;
     $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
     diag 'export SD_REPO=' . $ENV{'PROPHET_REPO'} . "\n";
-    # frob the editor to use a perl script instead of spawning vi/emacs/etc.
-    undef $ENV{'VISUAL'};       # Proc::InvokeEditor checks this first
-    $ENV{'EDITOR'} = File::Spec->catfile(getcwd(), 't', 'scripts', 'ticket-comment-update-editor.pl');
-    diag 'export EDITOR=' . $ENV{'EDITOR'} . "\n";
+    App::SD::Test->set_editor('ticket-comment-update-editor.pl');
 }
 
 # create ticket



More information about the Bps-public-commit mailing list