Skip to content

Commit

Permalink
more work on index testing
Browse files Browse the repository at this point in the history
  • Loading branch information
xdg committed Aug 19, 2011
1 parent 84750c8 commit d455a63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 52 deletions.
28 changes: 2 additions & 26 deletions lib/Metabase/Test/Archive.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package Metabase::Test::Archive;
# VERSION

use Metabase::Fact;
use Metabase::Test::Fact;
use Metabase::Test::Factory;
use Test::Deep qw/cmp_deeply/;
use Test::More 0.92;

Expand All @@ -24,31 +24,7 @@ requires '_build_archive';
# fixtures
#--------------------------------------------------------------------------#

my $dist_id = 'cpan:///distfile/UNKNOWN/Foo-Bar-1.23.tar.gz';
my %fact_content = (
fact1 => "Hello World",
fact2 => "Everything is fine",
);

has test_fact => (
traits => ['Hash'],
is => 'ro',
isa => Map[Str, class_type('Metabase::Test::Fact')],
default => sub {
my %hash;
for my $k ( keys %fact_content ) {
$hash{$k} = Metabase::Test::Fact->new(
resource => $dist_id,
content => $fact_content{$k},
);
};
return \%hash;
},
handles => {
get_test_fact => 'get',
keys_test_fact => 'keys',
},
);
with 'Metabase::Test::Factory';

has archive => (
is => 'ro',
Expand Down
28 changes: 2 additions & 26 deletions lib/Metabase/Test/Index.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,13 @@ use Moose::Util::TypeConstraints;
# requirements from composing class
#--------------------------------------------------------------------------#

requires '_build_archive';
requires '_build_index';

#--------------------------------------------------------------------------#
# fixtures
#--------------------------------------------------------------------------#

my $dist_id = 'cpan:///distfile/UNKNOWN/Foo-Bar-1.23.tar.gz';
my %fact_content = (
fact1 => "Hello World",
fact2 => "Everything is fine",
);

has test_fact => (
traits => ['Hash'],
is => 'ro',
isa => Map[Str, class_type('Metabase::Test::Fact')],
default => sub {
my %hash;
for my $k ( keys %fact_content ) {
$hash{$k} = Metabase::Test::Fact->new(
resource => $dist_id,
content => $fact_content{$k},
);
};
return \%hash;
},
handles => {
get_test_fact => 'get',
keys_test_fact => 'keys',
},
);
with 'Metabase::Test::Factory';

has index => (
is => 'ro',
Expand Down

0 comments on commit d455a63

Please sign in to comment.