App-GitHooks-Plugin-BlockProductionCommits

 view release on metacpan or  search on metacpan

t/10-run.t  view on Meta::CPAN

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
                                plugins                 => [ 'App::GitHooks::Plugin::BlockProductionCommits' ],
                        );
 
                        # Set up test files.
                        ok_add_files(
                                files      => $files,
                                repository => $repository,
                        );
 
                        # Try to commit.
                        my $stderr;
                        lives_ok(
                                sub
                                {
                                        $stderr = Capture::Tiny::capture_stderr(
                                                sub
                                                {
                                                        $repository->run( 'commit', '-m', 'Test message.' );
                                                }
                                        );
                                        note( $stderr );
                                },
                                'Commit the changes.',
                        );
 
                        if ( $test->{'allow'} )
                        {
                                unlike(
                                        $stderr,
                                        $failure,
                                        "The output matches expected results.",
                                );
                        }
                        else
                        {
                                like(
                                        $stderr,
                                        $failure,
                                        "The output matches expected results.",
                                );
                        }
                }
        );
}

t/12-missing_config.t  view on Meta::CPAN

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
        plugins                 => [ 'BlockProductionCommits' ],
);
 
# Set up test files.
ok_add_files(
        files      => $files,
        repository => $repository,
);
 
# Try to commit.
my $stderr;
lives_ok(
        sub
        {
                $stderr = Capture::Tiny::capture_stderr(
                        sub
                        {
                                $repository->run( 'commit', '-m', 'Test message.' );
                        }
                );
                note( $stderr );
        },
        'Commit the changes.',
);
 
like(
        $stderr,
        qr/\QYou must define 'env_variable' in the [BlockProductionCommits] section of your githooksrc config\E/,
        "The output matches expected results.",
);



( run in 0.247 second using v1.01-cache-2.11-cpan-05444aca049 )