[Bps-public-commit] r12230 - in Prophet/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Sun May 11 01:34:25 EDT 2008
Author: sartak
Date: Sun May 11 01:34:25 2008
New Revision: 12230
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/Makefile.PL
Prophet/trunk/lib/Prophet/Test.pm
Log:
r55551 at onn: sartak | 2008-05-11 01:34:21 -0400
load_record test function, dependency on Scalar::Defer
Modified: Prophet/trunk/Makefile.PL
==============================================================================
--- Prophet/trunk/Makefile.PL (original)
+++ Prophet/trunk/Makefile.PL Sun May 11 01:34:25 2008
@@ -23,6 +23,7 @@
requires('Module::Pluggable');
requires('File::Find::Rule');
requires('Proc::InvokeEditor');
+requires('Scalar::Defer');
features(
'REST Server' => [
Modified: Prophet/trunk/lib/Prophet/Test.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Test.pm (original)
+++ Prophet/trunk/lib/Prophet/Test.pm Sun May 11 01:34:25 2008
@@ -4,7 +4,7 @@
package Prophet::Test;
use base qw/Test::More Exporter/;
our @EXPORT = qw/as_alice as_bob as_charlie as_david as_user run_ok repo_uri_for run_script run_output_matches replica_last_rev replica_merge_tickets replica_uuid_for fetch_newest_changesets ok_added_revisions replica_uuid
- serialize_conflict serialize_changeset in_gladiator diag is_script_output run_command set_editor
+ serialize_conflict serialize_changeset in_gladiator diag is_script_output run_command set_editor load_record
/;
use File::Path 'rmtree';
@@ -13,6 +13,7 @@
use Test::Exception;
use IPC::Run3 'run3';
use Params::Validate ':all';
+use Scalar::Defer qw/lazy defer force/;
use Prophet::CLI;
@@ -347,12 +348,28 @@
=cut
sub run_command {
- my $output;
+ my $output = '';
open my $handle, '>', \$output;
Prophet::CLI->new->invoke($handle, @_);
return $output;
}
+{
+ my $connection = lazy {
+ my $cli = Prophet::CLI->new();
+ $cli->app_handle->handle;
+ };
+
+ sub load_record {
+ my $type = shift;
+ my $uuid = shift;
+
+ my $record = Prophet::Record->new(handle => $connection, type => $type);
+ $record->load(uuid => $uuid);
+ return $record;
+ }
+}
+
=head2 as_alice CODE, as_bob CODE, as_charlie CODE, as_david CODE
Runs CODE as alice, bob, charlie or david
More information about the Bps-public-commit
mailing list