File Coverage

blib/lib/Test/PlugAuth/Plugin/Refresh.pm
Criterion Covered Total %
statement 41 43 95.3
branch 3 6 50.0
condition n/a
subroutine 10 10 100.0
pod 1 1 100.0
total 55 60 91.6


line stmt bran cond sub pod time code
1             package Test::PlugAuth::Plugin::Refresh;
2              
3 3     3   600367 use strict;
  3         9  
  3         103  
4 3     3   18 use warnings;
  3         9  
  3         98  
5 3     3   1063 use PlugAuth;
  3         11  
  3         45  
6 3     3   117 use Clustericious::Config;
  3         8  
  3         67  
7 3     3   1304 use Test::PlugAuth::Plugin;
  3         8  
  3         86  
8 3     3   21 use Test::Builder;
  3         6  
  3         64  
9 3     3   16 use Role::Tiny ();
  3         6  
  3         61  
10 3     3   16 use base qw( Exporter );
  3         7  
  3         1064  
11              
12             our @EXPORT = qw( run_tests );
13              
14             # ABSTRACT: Test a PlugAuth Refresh plugin for correctness
15             our $VERSION = '0.38'; # VERSION
16              
17              
18             my $Test = Test::Builder->new;
19              
20             sub run_tests
21             {
22 3     3 1 297 my($class) = @_;
23 3 50       20 $class = "PlugAuth::Plugin::$class" unless $class =~ /::/;
24 3     3   1208 eval qq{ use $class };
  3         11  
  3         57  
  3         178  
25 3 50       15 die $@ if $@;
26            
27 3         29 $Test->plan( tests => 4);
28            
29 3         2889 my $object = eval { $class->new(Clustericious::Config->new({}), Clustericious::Config->new({}), PlugAuth->new) };
  3         38  
30 3         17 my $error = $@;
31 3 50       19 if(ref $object)
32             {
33 3         23 $Test->ok(1, "New returns a reference");
34             }
35             else
36             {
37 0         0 $Test->ok(0, "New returns a reference");
38 0         0 $Test->diag("ERROR: $error");
39             }
40            
41 3         1651 $Test->ok( Role::Tiny::does_role($object, 'PlugAuth::Role::Plugin'), 'does Plugin');
42 3         1233 $Test->ok( Role::Tiny::does_role($object, 'PlugAuth::Role::Refresh'), 'does Refresh');
43 3         1293 $Test->ok( eval { $object->can('refresh') }, "can refresh");
  3         29  
44             };
45              
46             1;
47              
48             __END__
49              
50             =pod
51              
52             =encoding UTF-8
53              
54             =head1 NAME
55              
56             Test::PlugAuth::Plugin::Refresh - Test a PlugAuth Refresh plugin for correctness
57              
58             =head1 VERSION
59              
60             version 0.38
61              
62             =head1 SYNOPSIS
63              
64             use Test::PlugAuth::Plugin::Refresh;
65             run_tests 'MyPlugin'; # runs tests against PlugAuth::Plugin::MyPlugin
66              
67             =head1 FUNCTIONS
68              
69             =head2 run_tests $plugin_name
70              
71             Run the specification tests against the given plugin.
72              
73             =head1 SEE ALSO
74              
75             L<PlugAuth>,
76             L<PlugAuth::Guide::Plugin>
77              
78             =head1 AUTHOR
79              
80             Graham Ollis <gollis@sesda3.com>
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             This software is copyright (c) 2012 by NASA GSFC.
85              
86             This is free software; you can redistribute it and/or modify it under
87             the same terms as the Perl 5 programming language system itself.
88              
89             =cut