Skip to content

Commit

Permalink
more LibreCat.pm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nics committed Apr 9, 2018
1 parent e66f55d commit 1430883
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions t/LibreCat.t
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
use Catmandu::Sane;
use Test::More;
use Test::Exception;
use Path::Tiny;
use LibreCat -load => {layer_paths => [qw(t/layer)]};
use LibreCat;

{
my $loaded = LibreCat->loaded;
like $loaded, qr/0|1/;
}
# class methods and loading

ok(LibreCat->loaded == 0);

dies_ok { LibreCat->instance } qr/must be loaded first/i;

LibreCat->load({layer_paths => [qw(t/layer)]});

ok(LibreCat->loaded == 1);

my $instance = LibreCat->instance;

ok($instance == LibreCat->instance, "instance is a singleton");

# config

is(ref $instance->config, 'HASH');
ok($instance->config == Catmandu->config, "LibreCat and Catmandu share a config hash");

# models
ok($instance->has_model('user') == 1);
ok($instance->has_model('gremlin') == 0);

isa_ok(
$instance->model('user'),
"LibreCat::Model::User",
Expand Down Expand Up @@ -120,6 +137,13 @@ isa_ok(
ok(!$model->search_bag->get($id), '...purged (index)');
}

# queue

isa_ok(
$instance->queue,
"LibreCat::JobQueue"
);

# hooks

{
Expand Down

0 comments on commit 1430883

Please sign in to comment.