Skip to content
Browse files

add Plugin::FormValidator::Lite

  • Loading branch information...
1 parent 9720644 commit 248b45242fed052a638adc0c5113063e742fb590 @fujiwara fujiwara committed
View
5 MANIFEST
@@ -1,3 +1,4 @@
+.gitignore
Changes
eg/app.psgi
inc/Module/Install.pm
@@ -45,6 +46,7 @@ lib/Ark/Plugin/Authentication/User.pm
lib/Ark/Plugin/Encoding/MobileJP.pm
lib/Ark/Plugin/Encoding/Null.pm
lib/Ark/Plugin/Encoding/Unicode.pm
+lib/Ark/Plugin/FormValidator/Lite.pm
lib/Ark/Plugin/I18N.pm
lib/Ark/Plugin/MobileAgent.pm
lib/Ark/Plugin/ReproxyCallback.pm
@@ -91,6 +93,9 @@ t/form/lib/T.pm
t/form/lib/T/Controller/Root.pm
t/form/lib/T/Form/Login.pm
t/form/lib/T/Models.pm
+t/form_validator_lite.t
+t/form_validator_lite/lib/T.pm
+t/form_validator_lite/lib/T/Controller/Root.pm
t/lazy_action_loader.t
t/lazy_action_loader/lib/TestApp.pm
t/lazy_action_loader/lib/TestApp/Controller/One.pm
View
17 lib/Ark/Plugin/FormValidator/Lite.pm
@@ -0,0 +1,17 @@
+package Ark::Plugin::FormValidator::Lite;
+
+use Ark::Plugin;
+use FormValidator::Lite;
+
+has validator => (
+ is => 'ro',
+ isa => 'FormValidator::Lite',
+ lazy => 1,
+ default => sub {
+ my ($c) = @_;
+ FormValidator::Lite->load_constraints(qw/Japanese/);
+ FormValidator::Lite->new( $c->request );
+ },
+);
+
+1;
View
15 t/form_validator_lite.t
@@ -0,0 +1,15 @@
+use Test::Base;
+use FindBin;
+use lib "$FindBin::Bin/form_validator_lite/lib";
+
+plan 'no_plan';
+
+use Ark::Test 'T';
+use HTTP::Request::Common;
+
+{
+ my ($res, $c) = ctx_get('/login');
+ isa_ok($c, 'Ark::Context');
+ isa_ok(my $form = $c->validator, "FormValidator::Lite");
+}
+
View
9 t/form_validator_lite/lib/T.pm
@@ -0,0 +1,9 @@
+package T;
+use Ark;
+
+use_plugins qw{
+ FormValidator::Lite
+};
+
+1;
+
View
10 t/form_validator_lite/lib/T/Controller/Root.pm
@@ -0,0 +1,10 @@
+package T::Controller::Root;
+use Ark "Controller";
+
+has '+namespace' => default => '';
+
+sub login :Local :Args(0) {
+ my ($self, $c) = @_;
+}
+
+1;

0 comments on commit 248b452

Please sign in to comment.
Something went wrong with that request. Please try again.