Skip to content

Commit

Permalink
[Minor] Removed Test::Needs for imcompatibility with Dist::Zilla. Man…
Browse files Browse the repository at this point in the history
…ual check of modules in tests
  • Loading branch information
EmilianoBruni committed Aug 4, 2021
1 parent 435dc5f commit c715989
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 47 deletions.
40 changes: 18 additions & 22 deletions t/30-restify_mongodb.t
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
BEGIN {
use Test::More;
use Test::Needs;
# prereq tests
test_needs qw/
Mojolicious::Plugin::Mongodbv2
Mojolicious::Plugin::Restify::OtherActions
/;
}

package Test::Skel::Test;
use Mojo::Base 'Mojo::Leds::Rest::MongoDB';
Expand All @@ -22,6 +13,24 @@ sub bac {

package main;

BEGIN {
use Test::More;

# prereq tests
my %mods = (
'Mojolicious::Plugin::Mongodbv2' => 0,
'Mojolicious::Plugin::Restify::OtherActions' => 0
);
while ( my ( $k, $v ) = each %mods ) {
eval "use $k $v";
delete $mods{$k} unless ($@);
}
plan skip_all => "Install ["
. join( ', ', keys(%mods) )
. "] to run this test"
if ( keys %mods );
}

use Mojo::Base -strict;

use Test::More;
Expand All @@ -36,19 +45,6 @@ my $www = $site->child('www')->to_string;
lib->import($lib);
lib->import($www);

# try to load plugins for this DB
# my $plugin_rest = 'Mojolicious::Plugin::Restify::OtherActions';
# eval "use $plugin_rest";
# plan skip_all => <<EOF if ($@);
# Install $plugin_rest to run these tests
# EOF
#
# my $plugin_db = 'Mojolicious::Plugin::Mongodbv2';
# eval "use $plugin_db";
# plan skip_all => <<EOF if ($@);
# Install $plugin_db to run these tests
# EOF

my $t = Test::Mojo->new('Skel');
push @{ $t->app->renderer->paths }, $www;

Expand Down
40 changes: 15 additions & 25 deletions t/40-restify_dbix.t
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
BEGIN {
use Test::More;
use Test::Needs;

# prereq tests
test_needs qw/
DBIx::Class
Mojolicious::Plugin::Restify::OtherActions
Mojolicious::Plugin::DBIC
DBD::SQLite
/;
my %mods = (
'DBIx::Class' => 0,
'Mojolicious::Plugin::Restify::OtherActions' => 0,
'Mojolicious::Plugin::DBIC' => 0,
'DBD::SQLite' => 0,
);
while ( my ( $k, $v ) = each %mods ) {
eval "use $k $v";
delete $mods{$k} unless ($@);
}
plan skip_all => "Install ["
. join( ', ', keys(%mods) )
. "] to run this test"
if ( keys %mods );
}

package Test::Skel::Test;
Expand Down Expand Up @@ -66,24 +74,6 @@ my $www = $site->child('www')->to_string;
lib->import($lib);
lib->import($www);

# try to load the plugins for this DB
# my $plugin_rest = 'Mojolicious::Plugin::Restify::OtherActions';
# eval "use $plugin_rest";
# plan skip_all => <<EOF if ($@);
# Install $plugin_rest to run these tests
# EOF
#
# my $plugin_db = 'Mojolicious::Plugin::DBIC';
# eval "use $plugin_db";
# plan skip_all => <<EOF if ($@);
# Install $plugin_db to run these tests
# EOF
#
# eval "use DBD::SQLite";
# plan skip_all => <<EOF if ($@);
# Install DBD::SQLite to run these tests
# EOF

my $t = Test::Mojo->new('Skel');
push @{ $t->app->renderer->paths }, $www;

Expand Down

0 comments on commit c715989

Please sign in to comment.