Tests: unbreak and extend has() functionality.
diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm
index bb3460a..d37be5d 100644
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -44,10 +44,26 @@
}
sub has {
- my ($self, $feature, %options) = @_;
+ my ($self, $feature) = @_;
+
+ my %regex = (
+ mail => '--with-mail',
+ rewrite => '(?s)^(?!.*--without-http_rewrite_module)',
+ static => '(?s)^(?!.*--without-http_static_module)',
+ );
+
Test::More::plan(skip_all => "$feature not compiled in")
- unless `$NGINX -V 2>&1` =~ $feature;
- Test::More::plan($options{plan}) if defined $options{plan};
+ unless `$NGINX -V 2>&1` =~ $regex{$feature};
+
+ return $self;
+}
+
+sub plan {
+ my ($self, $plan) = @_;
+
+ Test::More::plan(tests => $plan);
+
+ return $self;
}
sub run {
diff --git a/smtp-greeting-delay.t b/smtp-greeting-delay.t
index a901432..d4bbcd4 100644
--- a/smtp-greeting-delay.t
+++ b/smtp-greeting-delay.t
@@ -23,7 +23,7 @@
select STDERR; $| = 1;
select STDOUT; $| = 1;
-my $t = Test::Nginx->new()->has('mail', plan => 2)
+my $t = Test::Nginx->new()->has('mail')->plan(2)
->write_file_expand('nginx.conf', <<'EOF')->run();
master_process off;
diff --git a/smtp.t b/smtp.t
index 0fef9d5..1f51108 100644
--- a/smtp.t
+++ b/smtp.t
@@ -26,7 +26,7 @@
select STDOUT; $| = 1;
my $t = Test::Nginx->new()
- ->has('mail', plan => 26)
+ ->has('mail')->plan(26)
->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon)
->write_file_expand('nginx.conf', <<'EOF')->run();
diff --git a/ssi-include-big.t b/ssi-include-big.t
index 71fdab5..5d65f15 100644
--- a/ssi-include-big.t
+++ b/ssi-include-big.t
@@ -9,7 +9,7 @@
use warnings;
use strict;
-use Test::More tests => 3;
+use Test::More;
BEGIN { use FindBin; chdir($FindBin::Bin); }
@@ -21,7 +21,7 @@
select STDERR; $| = 1;
select STDOUT; $| = 1;
-my $t = Test::Nginx->new();
+my $t = Test::Nginx->has('rewrite')->plan(3)->new();
$t->write_file_expand('nginx.conf', <<'EOF');