Skip to content

Commit

Permalink
also factor out the D::S creation and initial MXSD instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
jrockway committed Jun 3, 2008
1 parent afee1a9 commit 1e0c6a9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 41 deletions.
12 changes: 2 additions & 10 deletions t/basic-storage.t
@@ -1,18 +1,10 @@
use strict;
use warnings;
use Test::More tests => 6;

use Directory::Scratch;
use MooseX::Storage::Directory;
use t::lib::Test;

my $tmp = Directory::Scratch->new;

my $dir = MooseX::Storage::Directory->new(
directory => qq{$tmp},
class => Test->meta,
);

my $tmp = tmp;
my $dir = storage;
ok $dir, 'created directory';

{
Expand Down
9 changes: 1 addition & 8 deletions t/index-arrays.t
@@ -1,16 +1,9 @@
use strict;
use warnings;
use Test::More tests => 3;
use Directory::Scratch;
use MooseX::Storage::Directory;
use t::lib::Test;

my $tmp = Directory::Scratch->new;

my $dir = MooseX::Storage::Directory->new(
directory => qq{$tmp},
class => Test->meta,
);
my $dir = storage;

my $foo = Test->new( id => 1, bar => [qw/foo yay/] );
my $bar = Test->new( id => 2, bar => [qw/bar yay/] );
Expand Down
12 changes: 2 additions & 10 deletions t/index.t
@@ -1,19 +1,11 @@
use strict;
use warnings;
use Test::More tests => 7;

use Directory::Scratch;
use MooseX::Storage::Directory;
use Test::Exception;
use t::lib::Test;

my $tmp = Directory::Scratch->new;

my $dir = MooseX::Storage::Directory->new(
directory => qq{$tmp},
class => Test->meta,
);

my $tmp = tmp;
my $dir = storage;
ok $dir, 'created directory';

{ my $foo = Test->new( id => 1, foo => 'Hello' );
Expand Down
22 changes: 19 additions & 3 deletions t/lib/Test.pm
@@ -1,6 +1,3 @@
package t::lib::Test;
1;

package Test;
use Moose;
with 'MooseX::Storage::Directory::Id';
Expand All @@ -12,3 +9,22 @@ has 'bar' => ( is => 'ro', isa => 'ArrayRef', required => 0 );
sub get_id { return shift->id }

1;

package t::lib::Test;
use strict;
use Directory::Scratch;
use MooseX::Storage::Directory;
use base 'Exporter';
our @EXPORT = qw/tmp storage/;

my $tmp = Directory::Scratch->new;
my $dir = MooseX::Storage::Directory->new(
directory => qq{$tmp},
class => Test->meta,
);

sub tmp { $tmp }
sub storage { $dir }

1;

12 changes: 2 additions & 10 deletions t/updates.t
@@ -1,18 +1,10 @@
use strict;
use warnings;
use Test::More tests => 7;

use Directory::Scratch;
use MooseX::Storage::Directory;
use t::lib::Test;

my $tmp = Directory::Scratch->new;

my $dir = MooseX::Storage::Directory->new(
directory => qq{$tmp},
class => Test->meta,
);

my $tmp = tmp;
my $dir = storage;
ok $dir, 'created directory';


Expand Down

0 comments on commit 1e0c6a9

Please sign in to comment.