NAME

Git::Wrapper::Plus::Tester - Utility for testing things with a git repository

VERSION

version 0.003000

SYNOPSIS

use Git::Wrapper::Plus::Tester;

my $t = Git::Wrapper::Plus::Tester->new();

$t->run_env( sub {

    my $wrapper = $t->git;

    $wrapper->init_db(); # ETC.

} );

DESCRIPTION

This module solves the problem of the tedious amount of leg work you need to do to simply execute a test with Git.

Namely:

  • Creating a scratch directory

  • Creating a fake home directory in that scratch directory

  • Setting HOME to that fake home

  • Setting valid, but bogus values for GIT_(COMMITTER|AUTHOR)_(NAME|EMAIL)

  • Creating a directory for the repository to work with in the scratch directory

  • Creating a Git::Wrapper instance with that repository path

This module does all of the above for you, and makes some of them flexible via attributes.

METHODS

run_env

Sets up basic environment, and runs code, reverting environment when done.

$o->run_env(sub {
    my $wrapper = $o->git;

});

ATTRIBUTES

temp_dir

OPTIONAL

home_dir

OPTIONAL

repo_dir

OPTIONAL

git

OPTIONAL

committer_name

OPTIONAL. Defaults to A. U. Thor

committer_email

OPTIONAL. Defaults to author@example.org

author_name

OPTIONAL. Defaults to ->committer_name

author_email

OPTIONAL. Defaults to ->committer_email

AUTHOR

Kent Fredric <kentfredric@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.