[Bps-public-commit] SD branch, config-gitlike, updated. 0cf13ad324b39026f4273451f9ec93620a55dcca
spang at bestpractical.com
spang at bestpractical.com
Fri Jun 26 05:43:08 EDT 2009
The branch, config-gitlike has been updated
via 0cf13ad324b39026f4273451f9ec93620a55dcca (commit)
via a82a51e31aaef6348a2f6fd74b19f1615cff8274 (commit)
via 73763bcf220d16513fb3999110dec5545b89df6f (commit)
from 12736f2bb1a27fdd5adeab7f3083e5900287e65c (commit)
Summary of changes:
lib/App/SD/Test.pm | 33 ----------
t/02-create-with-editor.t | 8 +-
t/03-update-ticket-with-editor.t | 8 +-
t/04-update-ticket-comment-with-editor.t | 2 +-
t/06-ticket-show.t | 4 +-
t/07-sort-group.t | 15 +++--
t/data/sd-settings-first.tmpl | 31 ---------
t/data/sd-settings-second.tmpl | 31 ---------
t/data/sd-settings-third.tmpl | 31 ---------
t/scripts/SDTestsEditor.pm | 95 -----------------------------
t/scripts/settings-editor.pl | 53 ----------------
t/scripts/ticket-create-editor.pl | 8 +-
t/scripts/ticket-update-editor.pl | 8 +-
t/sd-settings.t | 98 ------------------------------
14 files changed, 29 insertions(+), 396 deletions(-)
delete mode 100644 t/data/sd-settings-first.tmpl
delete mode 100644 t/data/sd-settings-second.tmpl
delete mode 100644 t/data/sd-settings-third.tmpl
delete mode 100755 t/scripts/SDTestsEditor.pm
delete mode 100755 t/scripts/settings-editor.pl
delete mode 100644 t/sd-settings.t
- Log -----------------------------------------------------------------
commit 73763bcf220d16513fb3999110dec5545b89df6f
Author: Christine Spang <spang at bestpractical.com>
Date: Thu Jun 25 15:36:47 2009 +0300
Move SDTestsEditor to Prophet and update tests.
Settings tests belong in Prophet as well, as SD uses this
command from Prophet without modification.
diff --git a/t/data/sd-settings-first.tmpl b/t/data/sd-settings-first.tmpl
deleted file mode 100644
index 8b0bd30..0000000
--- a/t/data/sd-settings-first.tmpl
+++ /dev/null
@@ -1,31 +0,0 @@
-# uuid: 1AF5CF74-A6D4-417E-A738-CCE64A0A7F71
-milestones: ["alpha","beta","1.0"]
-
-# uuid: 0AEC922F-57B1-44BE-9588-816E5841BB18
-default_component: ["core"]
-
-# uuid: 6CBD84A1-4568-48E7-B90C-F1A5B7BD8ECD
-components: ["core","ui","docs","tests"]
-
-# uuid: 3f0a074f-af13-406f-bf7b-d69bbf360720
-common_ticket_props: ["id","summary","original_replica"]
-
-# uuid: 2F9E6509-4468-438A-A733-246B3061003E
-default_status: ["new"]
-
-# uuid: C879A68F-8CFE-44B5-9EDD-14E53933669E
-active_statuses: ["new","open"]
-
-# uuid: BAB613BD-9E25-4612-8DE3-21E4572859EA
-default_milestone: ["alpha"]
-
-# uuid: c1bced3a-ad2c-42c4-a502-4149205060f1
-prop_descriptions: [{"due":"when this ticket must be finished by","owner":"the email address of the person who is responsible for this ticket","reporter":"the email address of the person who reported this ticket","summary":"a one-line summary of what this ticket is about"}]
-
-# uuid: 24183C4D-EFD0-4B16-A207-ED7598E875E6
-statuses: ["new","open","stalled","closed","rejected"]
-
-# uuid: 3B4B297C-906F-4018-9829-F7CC672274C9
-project_name: ["Your SD Project"]
-
-
diff --git a/t/data/sd-settings-second.tmpl b/t/data/sd-settings-second.tmpl
deleted file mode 100644
index 39f233d..0000000
--- a/t/data/sd-settings-second.tmpl
+++ /dev/null
@@ -1,31 +0,0 @@
-# uuid: 1AF5CF74-A6D4-417E-A738-CCE64A0A7F71
-milestones: ["alpha","beta","1.0"]
-
-# uuid: 0AEC922F-57B1-44BE-9588-816E5841BB18
-default_component: ["core"]
-
-# uuid: 6CBD84A1-4568-48E7-B90C-F1A5B7BD8ECD
-components: ["core","ui","docs","tests"]
-
-# uuid: 3f0a074f-af13-406f-bf7b-d69bbf360720
-common_ticket_props: ["id","summary","original_replica"]
-
-# uuid: 2F9E6509-4468-438A-A733-246B3061003E
-default_status: ["open"]
-
-# uuid: C879A68F-8CFE-44B5-9EDD-14E53933669E
-active_statuses: ["new","open"]
-
-# uuid: BAB613BD-9E25-4612-8DE3-21E4572859EA
-default_milestone: ["alpha"]
-
-# uuid: c1bced3a-ad2c-42c4-a502-4149205060f1
-prop_descriptions: [{"due":"when this ticket must be finished by","owner":"the email address of the person who is responsible for this ticket","reporter":"the email address of the person who reported this ticket","summary":"a one-line summary of what this ticket is about"}]
-
-# uuid: 24183C4D-EFD0-4B16-A207-ED7598E875E6
-statuses: ["new","open","stalled","closed","rejected"]
-
-# uuid: 3B4B297C-906F-4018-9829-F7CC672274C9
-project_name: ["Your SD Project"]
-
-
diff --git a/t/data/sd-settings-third.tmpl b/t/data/sd-settings-third.tmpl
deleted file mode 100644
index 0eeac94..0000000
--- a/t/data/sd-settings-third.tmpl
+++ /dev/null
@@ -1,31 +0,0 @@
-# uuid: 1AF5CF74-A6D4-417E-A738-CCE64A0A7F71
-milestones: ["alpha","beta","1.0"]
-
-# uuid: 0AEC922F-57B1-44BE-9588-816E5841BB18
-default_component: ["ui"]
-
-# uuid: 6CBD84A1-4568-48E7-B90C-F1A5B7BD8ECD
-components: ["core","ui","docs","tests"]
-
-# uuid: 3f0a074f-af13-406f-bf7b-d69bbf360720
-common_ticket_props: ["id","summary","original_replica"]
-
-# uuid: 2F9E6509-4468-438A-A733-246B3061003E
-default_status: ["open"]
-
-# uuid: C879A68F-8CFE-44B5-9EDD-14E53933669E
-active_statuses: ["new","open"]
-
-# uuid: BAB613BD-9E25-4612-8DE3-21E4572859EA
-default_milestone: ["alpha"]
-
-# uuid: c1bced3a-ad2c-42c4-a502-4149205060f1
-prop_descriptions: [{"due":"when this ticket must be finished by","owner":"the email address of the person who is responsible for this ticket","reporter":"the email address of the person who reported this ticket","summary":"a one-line summary of what this ticket is about"}]
-
-# uuid: 24183C4D-EFD0-4B16-A207-ED7598E875E6
-statuses: ["new","open","stalled","closed","rejected"]
-
-# uuid: 3B4B297C-906F-4018-9829-F7CC672274C9
-project_name: ["Your SD Project"]
-
-
diff --git a/t/scripts/SDTestsEditor.pm b/t/scripts/SDTestsEditor.pm
deleted file mode 100755
index 550a92d..0000000
--- a/t/scripts/SDTestsEditor.pm
+++ /dev/null
@@ -1,95 +0,0 @@
-package SDTestsEditor;
-use strict;
-use warnings;
-
-use Prophet::Util;
-use Params::Validate;
-use File::Spec;
-
-=head2 edit( tmpl_files => $tmpl_files, edit_callback => sub {}, verify_callback => sub {} )
-
-Expects @ARGV to contain at least an option and a file to be edited. It
-can also contain a replica uuid, a ticket uuid, and a status file. The last
-item must always be the file to be edited. The others, if they appear, must
-be in that order after the option. The status file must contain the
-string 'status' in its filename.
-
-edit_callback is called on each line of the file being edited. It should make
-any edits to the lines it receives and then print what it wants to be saved to
-the file.
-
-verify_callback is called after editing is done. If you need to write
-whether the template was correct to a status file, for example, this
-should be done here.
-
-=cut
-
-sub edit {
- my %args = @_;
- validate( @_, { edit_callback => 1,
- verify_callback => 1,
- tmpl_files => 1,
- }
- );
-
- my $option = shift @ARGV;
- my $tmpl_file = $args{tmpl_files}->{$option};
-
- chomp ( my @valid_template =
- Prophet::Util->slurp("t/data/$tmpl_file") );
-
- my $status_file = $ARGV[-2] =~ /status/ ? delete $ARGV[-2] : undef;
- # a bit of a hack to dermine whether the last arg is a filename
- my $replica_uuid = File::Spec->file_name_is_absolute($ARGV[0]) ? undef : shift @ARGV;
- my $ticket_uuid = File::Spec->file_name_is_absolute($ARGV[0]) ? undef : shift @ARGV;
-
- my @template = ();
- while (<>) {
- chomp( my $line = $_ );
- push @template, $line;
-
- $args{edit_callback}( option => $option, template => \@template,
- valid_template => \@valid_template,
- replica_uuid => $replica_uuid,
- ticket_uuid => $ticket_uuid );
- }
-
- $args{verify_callback}( template => \@template,
- valid_template => \@valid_template, status_file => $status_file );
-}
-
-=head2 check_template_by_line($template, $valid_template, $errors)
-
-$template is a reference to an array containing the template to check,
-split into lines. $valid_template is the same for the template to
-check against. Lines in these arrays should not have trailing newlines.
-$errors is a reference to an array where error messages will be stored.
-
-Lines in $valid_template should consist of either plain strings, or strings
-beginning with 'qr/' (to delimit a regexp object).
-
-Returns true if the templates match and false otherwise.
-
-=cut
-
-sub check_template_by_line {
- my @template = @{ shift @_ };
- my @valid_template = @{ shift @_ };
- my $replica_uuid = shift;
- my $ticket_uuid = shift;
- my $errors = shift;
-
- for my $valid_line (@valid_template) {
- my $line = shift @template;
-
- push @$errors, "got nothing, expected [$valid_line]" if !defined($line);
-
- push @$errors, "[$line] doesn't match [$valid_line]"
- if ($valid_line =~ /^qr\//) ? $line !~ eval($valid_line)
- : $line eq $valid_line;
- }
-
- return !(@$errors == 0);
-}
-
-1;
diff --git a/t/scripts/settings-editor.pl b/t/scripts/settings-editor.pl
deleted file mode 100755
index c640dd7..0000000
--- a/t/scripts/settings-editor.pl
+++ /dev/null
@@ -1,53 +0,0 @@
-#!perl -i
-use strict;
-use warnings;
-use lib 't/scripts';
-use SDTestsEditor;
-
-# perl script to trick Proc::InvokeEditor with for the settings command
-
-my %tmpl_files = ( '--first' => 'sd-settings-first.tmpl',
- '--second' => 'sd-settings-second.tmpl',
- );
-
-SDTestsEditor::edit( tmpl_files => { '--first' => 'sd-settings-first.tmpl',
- '--second' => 'sd-settings-second.tmpl',
- },
- edit_callback => sub {
- my %args = @_;
- my $option = $args{option};
-
- if ($option eq '--first') {
- s/(?<=^default_status: \[")new(?="\])/open/; # valid json change
- s/^default_milestone(?=: \["alpha"\])$/invalid_setting/; # changes setting name
- s/(?<=uuid: B)A(?=B613BD)/F/; # changes a UUID to an invalid one
- s/^project_name//; # deletes setting
- } elsif ($option eq '--second') {
- s/(?<=^default_component: \[")core(?="\])/ui/; # valid json change
- s/(?<=^default_milestone: \["alpha")]$//; # invalid json
- }
- print;
- },
- verify_callback => sub {
- my %args = @_;
-
- my $ok = 1;
-
- my %seen; # lookup table
- my @vonly; # answer
-
- # build lookup table
- @seen{@{$args{template}}} = ( );
-
- for my $line (@{$args{valid_template}}) {
- push(@vonly, $line) unless exists $seen{$line};
- }
-
- # if anything is only in the valid template, we don't match
- $ok = 0 if scalar @vonly;
-
- open STATUSFILE, '>', $args{status_file};
- $ok ? print STATUSFILE "ok!" : print STATUSFILE "not ok!";
- close STATUSFILE;
- }
-);
diff --git a/t/scripts/ticket-create-editor.pl b/t/scripts/ticket-create-editor.pl
index 2c9f6bf..c896eac 100755
--- a/t/scripts/ticket-create-editor.pl
+++ b/t/scripts/ticket-create-editor.pl
@@ -1,13 +1,13 @@
#!perl -i
use strict;
use warnings;
-use lib 't/scripts';
-use SDTestsEditor;
+use Prophet::Test::Editor;
# perl script to trick Proc::InvokeEditor with for the ticket create command
-SDTestsEditor::edit( tmpl_files => { '--no-args' => 'sd-ticket-create.tmpl',
+Prophet::Test::Editor::edit(
+ tmpl_files => { '--no-args' => 'sd-ticket-create.tmpl',
'--all-props' => 'sd-ticket-create.tmpl',
'--verbose' => 'sd-ticket-create-verbose.tmpl',
'--verbose-and-all' => 'sd-ticket-create-verbose.tmpl',
@@ -21,7 +21,7 @@ SDTestsEditor::edit( tmpl_files => { '--no-args' => 'sd-ticket-create.tmpl',
if ( /^=== add new ticket comment below ===$/) {
my $errors = [];
my $template_ok =
- SDTestsEditor::check_template_by_line($args{template},
+ Prophet::Test::Editor::check_template_by_line($args{template},
$args{valid_template}, $args{replica_uuid},
$args{ticket_uuid}, $errors);
if ($template_ok) {
diff --git a/t/scripts/ticket-update-editor.pl b/t/scripts/ticket-update-editor.pl
index 2b527db..c1f6872 100755
--- a/t/scripts/ticket-update-editor.pl
+++ b/t/scripts/ticket-update-editor.pl
@@ -1,12 +1,12 @@
#!perl -i
use strict;
use warnings;
-use lib 't/scripts';
-use SDTestsEditor;
+use Prophet::Test::Editor;
# perl script to trick Proc::InvokeEditor with for the ticket update command
-SDTestsEditor::edit( tmpl_files => { '--no-args' => 'sd-ticket-update.tmpl',
+Prophet::Test::Editor::edit(
+ tmpl_files => { '--no-args' => 'sd-ticket-update.tmpl',
'--all-props' => 'sd-ticket-update-all-props.tmpl',
'--verbose' => 'sd-ticket-update-verbose.tmpl',
'--verbose-and-all' =>
@@ -38,7 +38,7 @@ SDTestsEditor::edit( tmpl_files => { '--no-args' => 'sd-ticket-update.tmpl',
if ( /^=== add new ticket comment below ===$/) {
my $errors = [];
my $template_ok =
- SDTestsEditor::check_template_by_line($args{template},
+ Prophet::Test::Editor::check_template_by_line($args{template},
$args{valid_template}, $args{replica_uuid},
$args{ticket_uuid}, $errors);
if ($template_ok) {
diff --git a/t/sd-settings.t b/t/sd-settings.t
deleted file mode 100644
index ce344da..0000000
--- a/t/sd-settings.t
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-use Prophet::Test tests => 8;
-use App::SD::Test;
-use Prophet::Util;
-use File::Temp qw(tempdir);
-use File::Spec;
-no warnings 'once';
-
-# test the CLI and interactive UIs for showing and updating settings
-
-BEGIN {
- require File::Temp;
- $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'}
- = File::Temp::tempdir( CLEANUP => 1 ) . '/_svb';
- diag $ENV{'PROPHET_REPO'};
-}
-
-run_script( 'sd', [ 'init']);
-
-
-my $replica_uuid = replica_uuid;
-
-# test noninteractive set
-run_output_matches( 'sd', [ 'settings', '--set', '--', 'common_ticket_props',
- '["id","summary","original_replica"]' ],
- [
- 'Trying to change common_ticket_props from ["id","summary","status","milestone","component","owner","created","due","creator","reporter","original_replica"] to ["id","summary","original_replica"].',
- ' -> Changed.',
- ], [], "settings --set went ok",
-);
-
-# check with settings --show
-my @valid_settings_output = Prophet::Util->slurp('t/data/sd-settings-first.tmpl');
-chomp (@valid_settings_output);
-
-run_output_matches(
- 'sd',
- [ qw/settings --show/ ],
- [ @valid_settings_output ], [], "changed settings output matches"
-);
-
-# test sd settings (interactive editing)
-
-my $filename = File::Temp->new(
- TEMPLATE => File::Spec->catfile(File::Spec->tmpdir(), '/statusXXXXX') )->filename;
-diag ("interactive template status will be found in $filename");
-# first set the editor to an editor script
-App::SD::Test->set_editor("settings-editor.pl --first $filename");
-
-# then edit the settings
-run_output_matches( 'sd', [ 'settings' ],
- [
- 'Setting with uuid "BFB613BD-9E25-4612-8DE3-21E4572859EA" does not exist.',
- 'Changed default_status from ["new"] to ["open"].',
- ], [], "interactive settings set went ok",);
-
-# check the tempfile to see if the template presented to the editor was correct
-chomp(my $template_ok = Prophet::Util->slurp($filename));
-is($template_ok, 'ok!', "interactive template was correct");
-
-# check the settings with settings --show
- at valid_settings_output = Prophet::Util->slurp('t/data/sd-settings-second.tmpl');
-chomp (@valid_settings_output);
-
-run_output_matches(
- 'sd',
- [ qw/settings --show/ ],
- [ @valid_settings_output ], [], "changed settings output matches"
-);
-
-# test setting to invalid json
-my $second_filename = File::Temp->new(
- TEMPLATE => File::Spec->catfile(File::Spec->tmpdir(), '/statusXXXXX') )->filename;
-diag ("interactive template status will be found in $second_filename");
-App::SD::Test->set_editor("settings-editor.pl --second $second_filename");
-run_output_matches( 'sd', [ 'settings' ],
- [
- qr/^An error occured setting default_milestone to \["alpha":/,
- 'Changed default_component from ["core"] to ["ui"].',
- ], [], "interactive settings set with JSON error went ok",
-);
-
-# check the tempfile to see if the template presented to the editor was correct
-chomp($template_ok = Prophet::Util->slurp($filename));
-is($template_ok, 'ok!', "interactive template was correct");
-
-# check the settings with settings --show
- at valid_settings_output = Prophet::Util->slurp('t/data/sd-settings-third.tmpl');
-chomp (@valid_settings_output);
-
-run_output_matches(
- 'sd',
- [ qw/settings --show/ ],
- [ @valid_settings_output ], [], "changed settings output matches"
-);
commit a82a51e31aaef6348a2f6fd74b19f1615cff8274
Author: Christine Spang <spang at bestpractical.com>
Date: Fri Jun 26 11:55:07 2009 +0300
Move App::SD::Test->set_editor to Prophet::Test->set_editor_script
diff --git a/lib/App/SD/Test.pm b/lib/App/SD/Test.pm
index 3333970..e457fa9 100644
--- a/lib/App/SD/Test.pm
+++ b/lib/App/SD/Test.pm
@@ -7,7 +7,6 @@ require Prophet::Test;
use Test::More;
use File::Spec;
use File::Temp ();
-use Cwd qw/getcwd/;
use base qw/Exporter/;
our @EXPORT = qw(create_ticket_ok update_ticket_ok create_ticket_with_editor_ok create_ticket_comment_ok get_uuid_for_luid get_luid_for_uuid get_ticket_info);
delete $ENV{'PROPHET_APP_CONFIG'};
@@ -224,23 +223,6 @@ sub get_ticket_info {
return \%res;
}
-=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) = @_;
-
- delete $ENV{'VISUAL'}; # Proc::InvokeEditor checks this first
- $ENV{'EDITOR'} = "$^X " . File::Spec->catfile(getcwd(), 't', 'scripts', $script);
- diag "export EDITOR=" . $ENV{'EDITOR'} . "\n";
-}
-
=head2 write_to_file FILENAME DATA
Takes the string given in DATA and writes it to the file whose name is given
diff --git a/t/02-create-with-editor.t b/t/02-create-with-editor.t
index a8eafc2..761a406 100644
--- a/t/02-create-with-editor.t
+++ b/t/02-create-with-editor.t
@@ -50,18 +50,18 @@ sub create_ticket_and_check {
}
# test template for sd ticket create
-App::SD::Test->set_editor("ticket-create-editor.pl --no-args $replica_uuid");
+Prophet::Test->set_editor_script("ticket-create-editor.pl --no-args $replica_uuid");
create_ticket_and_check(check_sd_list => 1);
# test template for sd ticket create --all-props
-App::SD::Test->set_editor("ticket-create-editor.pl --all-props $replica_uuid");
+Prophet::Test->set_editor_script("ticket-create-editor.pl --all-props $replica_uuid");
create_ticket_and_check(extra_args => ['--all-props']);
# test template for sd ticket create --verbose
-App::SD::Test->set_editor("ticket-create-editor.pl --verbose $replica_uuid");
+Prophet::Test->set_editor_script("ticket-create-editor.pl --verbose $replica_uuid");
create_ticket_and_check(extra_args => ['--verbose']);
# test template for sd ticket create --verbose --all-props
-App::SD::Test->set_editor("ticket-create-editor.pl --verbose-and-all $replica_uuid");
+Prophet::Test->set_editor_script("ticket-create-editor.pl --verbose-and-all $replica_uuid");
create_ticket_and_check(extra_args => ['--all-props', '--verbose']);
diff --git a/t/03-update-ticket-with-editor.t b/t/03-update-ticket-with-editor.t
index a269236..57c76a7 100644
--- a/t/03-update-ticket-with-editor.t
+++ b/t/03-update-ticket-with-editor.t
@@ -41,7 +41,7 @@ run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $ticket_id ],
]
);
-App::SD::Test->set_editor("ticket-update-editor.pl --no-args $replica_uuid $ticket_uuid");
+Prophet::Test->set_editor_script("ticket-update-editor.pl --no-args $replica_uuid $ticket_uuid");
# update it
my ($comment_id, $comment_uuid) = App::SD::Test->update_ticket_with_editor_ok($ticket_id, $ticket_uuid);
@@ -80,7 +80,7 @@ sub check_comment_ok {
check_comment_ok();
# sd ticket edit 20 --all-props
-App::SD::Test->set_editor("ticket-update-editor.pl --all-props $replica_uuid $ticket_uuid");
+Prophet::Test->set_editor_script("ticket-update-editor.pl --all-props $replica_uuid $ticket_uuid");
# update it
# template should show the hidden component prop
@@ -104,7 +104,7 @@ run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $ticket_id ]
check_comment_ok();
# sd ticket edit 20 --verbose
-App::SD::Test->set_editor("ticket-update-editor.pl --verbose $replica_uuid $ticket_uuid");
+Prophet::Test->set_editor_script("ticket-update-editor.pl --verbose $replica_uuid $ticket_uuid");
# update it
($comment_id, $comment_uuid) = App::SD::Test->update_ticket_with_editor_ok($ticket_id, $ticket_uuid, '--verbose');
@@ -127,7 +127,7 @@ run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $ticket_id ],
check_comment_ok();
# sd ticket edit 20 --verbose --all-props
-App::SD::Test->set_editor("ticket-update-editor.pl --verbose-and-all $replica_uuid $ticket_uuid");
+Prophet::Test->set_editor_script("ticket-update-editor.pl --verbose-and-all $replica_uuid $ticket_uuid");
diag('changing settings for regression test: make sure props aren\'t deleted');
diag('if they weren\'t presented for editing in the first place');
diff --git a/t/04-update-ticket-comment-with-editor.t b/t/04-update-ticket-comment-with-editor.t
index 16cf518..026cbfa 100644
--- a/t/04-update-ticket-comment-with-editor.t
+++ b/t/04-update-ticket-comment-with-editor.t
@@ -8,7 +8,7 @@ BEGIN {
require File::Temp;
$ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 1 ) . '/_svb';
diag 'export SD_REPO=' . $ENV{'PROPHET_REPO'} . "\n";
- App::SD::Test->set_editor('ticket-comment-update-editor.pl');
+ Prophet::Test->set_editor_script('ticket-comment-update-editor.pl');
}
run_script( 'sd', [ 'init']);
commit 0cf13ad324b39026f4273451f9ec93620a55dcca
Author: Christine Spang <spang at bestpractical.com>
Date: Fri Jun 26 12:21:29 2009 +0300
Prophet::Util already has write_file; kill App::SD::Test->write_to_file
Also, some tests in t/07-sort-group.t were still using ticket.search
rather than ticket.list. Fixed that.
diff --git a/lib/App/SD/Test.pm b/lib/App/SD/Test.pm
index e457fa9..aea276e 100644
--- a/lib/App/SD/Test.pm
+++ b/lib/App/SD/Test.pm
@@ -223,19 +223,4 @@ sub get_ticket_info {
return \%res;
}
-=head2 write_to_file FILENAME DATA
-
-Takes the string given in DATA and writes it to the file whose name is given
-by FILENAME.
-
-=cut
-
-sub write_to_file {
- my ($self, $filename, $data) = @_;
-
- open FH, '>', $filename;
- print FH $data;
- close FH;
-}
-
1;
diff --git a/t/06-ticket-show.t b/t/06-ticket-show.t
index 046eae1..7a819a9 100644
--- a/t/06-ticket-show.t
+++ b/t/06-ticket-show.t
@@ -4,6 +4,7 @@ use strict;
use Prophet::Test tests => 6;
use App::SD::Test;
+use Prophet::Util;
use File::Temp qw/tempdir/;
use Term::ANSIColor;
@@ -92,7 +93,8 @@ diag("passing --skip history (doesn't show history)");
check_output_without_history('--skip-history');
my $config_filename = $ENV{'SD_REPO'} . '/config';
-App::SD::Test->write_to_file($config_filename, '
+Prophet::Util->write_file(
+ file => $config_filename, content => '
[ticket "show"]
disable-history = true
');
diff --git a/t/07-sort-group.t b/t/07-sort-group.t
index e57401f..bdf4123 100644
--- a/t/07-sort-group.t
+++ b/t/07-sort-group.t
@@ -3,6 +3,7 @@
use strict;
use Prophet::Test tests => 11;
+use Prophet::Util;
use App::SD::Test;
use File::Temp qw/tempdir/;
@@ -39,13 +40,14 @@ run_output_matches( 'sd', [ 'ticket', 'list', '--sort', 'owner' ],
);
my $config_filename = $ENV{'SD_REPO'} . '/config';
-App::SD::Test->write_to_file($config_filename, '
-[ticket "search"]
+Prophet::Util->write_file(
+ file => $config_filename, content => '
+[ticket "list"]
default-sort = owner
');
$ENV{'SD_CONFIG'} = $config_filename;
-diag('using ticket.search.default-sort = owner');
+diag('using ticket.list.default-sort = owner');
run_output_matches( 'sd', [ 'ticket', 'list' ],
[ qr/(\d+) huzzah! new/,
qr/(\d+) YATTA new/,
@@ -59,7 +61,7 @@ run_output_matches( 'sd', [ 'ticket', 'list', '--sort' ],
]
);
-diag('using ticket.search.default-sort = owner and --sort none');
+diag('using ticket.list.default-sort = owner and --sort none');
run_output_matches( 'sd', [ 'ticket', 'list', '--sort', 'none' ],
[ qr/(\d+) YATTA new/,
qr/(\d+) huzzah! new/,
@@ -84,8 +86,9 @@ run_output_matches( 'sd', [ 'ticket', 'list', '--group', 'owner' ],
);
diag('using ticket.search.default-group = owner');
-App::SD::Test->write_to_file($config_filename, '
-[ticket "search"]
+Prophet::Util->write_file(
+ file => $config_filename, content => '
+[ticket "list"]
default-group = owner
');
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list