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   1583 use strict;
  3         4  
  3         94  
4 3     3   13 use warnings;
  3         4  
  3         80  
5 3     3   1310 use PlugAuth;
  3         8  
  3         63  
6 3     3   111 use Clustericious::Config;
  3         3  
  3         60  
7 3     3   1251 use Test::PlugAuth::Plugin;
  3         6  
  3         92  
8 3     3   2110 use Test::Builder;
  3         155431  
  3         123  
9 3     3   33 use Role::Tiny ();
  3         6  
  3         74  
10 3     3   16 use base qw( Exporter );
  3         6  
  3         1152  
11              
12             our @EXPORT = qw( run_tests );
13              
14             # ABSTRACT: Test a PlugAuth Refresh plugin for correctness
15             our $VERSION = '0.35'; # VERSION
16              
17              
18             my $Test = Test::Builder->new;
19              
20             sub run_tests
21             {
22 3     3 1 444 my($class) = @_;
23 3 50       23 $class = "PlugAuth::Plugin::$class" unless $class =~ /::/;
24 3     3   1970 eval qq{ use $class };
  3         11  
  3         80  
  3         220  
25 3 50       36 die $@ if $@;
26            
27 3         41 $Test->plan( tests => 4);
28            
29 3         2934 my $object = eval { $class->new(Clustericious::Config->new({}), Clustericious::Config->new({}), PlugAuth->new) };
  3         42  
30 3         14 my $error = $@;
31 3 50       13 if(ref $object)
32             {
33 3         27 $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         1910 $Test->ok( Role::Tiny::does_role($object, 'PlugAuth::Role::Plugin'), 'does Plugin');
42 3         878 $Test->ok( Role::Tiny::does_role($object, 'PlugAuth::Role::Refresh'), 'does Refresh');
43 3         854 $Test->ok( eval { $object->can('refresh') }, "can refresh");
  3         28  
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.35
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