Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixing test failures #15

Closed
wants to merge 2 commits into from

2 participants

@augensalat

Hi Al,

hope these fixes will help to make Validation::Class pass tests.

Bernhard

@alnewkirk alnewkirk closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 39 additions and 48 deletions.
  1. +2 −3 t/02-keyword-object.t
  2. +37 −45 t/09-modifiers.t
View
5 t/02-keyword-object.t
@@ -9,13 +9,12 @@ use Test::More;
SKIP: {
- eval { require 'DBI.pm' && require 'DBD/SQLite.pm' };
+ eval { require DBI && require DBD::SQLite };
plan skip_all => 'DBI or DBD::SQLite is not installed.' if $@;
package TestClass::ObjectKeyword;
- use DBI;
use Validation::Class;
fld name => {
@@ -85,4 +84,4 @@ SKIP: {
}
-done_testing;
+done_testing;
View
82 t/09-modifiers.t
@@ -1,36 +1,30 @@
+use Test::More;
+
BEGIN {
-
- use FindBin;
- use lib $FindBin::Bin . "/lib";
-
+ eval { require Class::Method::Modifiers }
+ or plan skip_all => 'Class::Method::Modifiers is not installed.';
}
-use Test::More;
-
-SKIP: {
-
- eval { require 'Class/Method/Modifiers.pm' };
-
- plan skip_all => 'Class::Method::Modifiers is not installed.' if $@;
-
+{
package TestClass::Modified;
+ Class::Method::Modifiers->import('after');
+
use Validation::Class;
- use Class::Method::Modifiers;
-
+
fld name => {
required => 1
};
has log => 0;
- after validate => sub {
+ after(validate => sub {
my ($self) = @_;
$self->log($self->error_count ? 1 : 0);
- };
+ });
mth change_log => {
input => ['name'],
@@ -39,39 +33,37 @@ SKIP: {
}
};
- after change_log => sub {
+ after(change_log => sub {
my ($self) = @_;
$self->log($self->log eq 'thank you' ? 1 : 0);
- };
-
- package main;
-
- my $class = "TestClass::Modified";
- my $self = $class->new;
-
- ok $class eq ref $self, "$class instantiated";
-
- $self->validate('name');
-
- ok $self->log, "validate() modifier setting log attribute as expected";
-
- $self->name('iamlegend');
- $self->validate('name');
-
- ok ! $self->log, "validate() modifier setting log attribute as expected";
-
- ok $self->change_log, "change_log() validates as expected";
-
- ok $self->log, "change_log() modifier setting log attribute as expected";
-
- $self->name('');
- $self->change_log;
-
- ok ! $self->log, "change_log() modifier setting log attribute as expected";
-
+ });
}
-done_testing;
+my $class = "TestClass::Modified";
+my $self = $class->new;
+
+ok $class eq ref $self, "$class instantiated";
+
+$self->validate('name');
+
+ok $self->log, "validate() modifier setting log attribute as expected";
+
+$self->name('iamlegend');
+$self->validate('name');
+
+ok ! $self->log, "validate() modifier setting log attribute as expected";
+
+ok $self->change_log, "change_log() validates as expected";
+
+ok $self->log, "change_log() modifier setting log attribute as expected";
+
+$self->name('');
+$self->change_log;
+
+ok ! $self->log, "change_log() modifier setting log attribute as expected";
+
+
+done_testing;
Something went wrong with that request. Please try again.