diff --git a/t/basic-storage.t b/t/basic-storage.t index 5c1b44a..0b0ccda 100644 --- a/t/basic-storage.t +++ b/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'; { diff --git a/t/index-arrays.t b/t/index-arrays.t index de83a0c..e806f28 100644 --- a/t/index-arrays.t +++ b/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/] ); diff --git a/t/index.t b/t/index.t index dc64759..275d100 100644 --- a/t/index.t +++ b/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' ); diff --git a/t/lib/Test.pm b/t/lib/Test.pm index f19e687..0d60571 100644 --- a/t/lib/Test.pm +++ b/t/lib/Test.pm @@ -1,6 +1,3 @@ -package t::lib::Test; -1; - package Test; use Moose; with 'MooseX::Storage::Directory::Id'; @@ -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; + diff --git a/t/updates.t b/t/updates.t index a115e3a..056a42a 100644 --- a/t/updates.t +++ b/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';