Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Refactor create repo dir

  • Loading branch information...
commit 95f3919707929bf0e116ea6034eba32e88a187cf 1 parent 6349dde
R3VoLuT1OneR R3VoLuT1OneR authored

Showing 2 changed files with 38 additions and 47 deletions. Show diff stats Hide diff stats

  1. +38 0 t/05_create_repo.t
  2. +0 47 t/create_repo.t
38 t/05_create_repo.t
... ... @@ -0,0 +1,38 @@
  1 +use strict;
  2 +use warnings;
  3 +use Test::More tests => 7;
  4 +use Test::File;
  5 +use t::lib::Functions;
  6 +
  7 +use Gup;
  8 +
  9 +my $dir = File::Spec->catdir( t::lib::Functions::create_test_dir, 'test_gup' );
  10 +my $gup = Gup->new( repo_dir => $dir );
  11 +
  12 +$gup->create_repo;
  13 +
  14 +isa_ok( $gup->repo, 'Git::Repository' );
  15 +
  16 +my $file = t::lib::Functions::create_test_file($dir);
  17 +
  18 +dir_exists_ok(
  19 + $dir,
  20 + 'test repo dir exists',
  21 +);
  22 +
  23 +dir_exists_ok(
  24 + File::Spec->catdir( $dir, '.git' ),
  25 + 'test repo .git dir exists',
  26 +);
  27 +
  28 +file_exists_ok( $file, "Repo test file $file created" );
  29 +file_contains_like( $file, qr/this is a test line/, 'Correct output' );
  30 +
  31 +$gup->repo->run( 'add', $file );
  32 +$gup->repo->run( 'commit', '-m', 'test commit' );
  33 +
  34 +my $output = $gup->repo->run('log');
  35 +
  36 +like( $output, qr/Initial commit/, 'Correct initial commit' );
  37 +like( $output, qr/test commit/ , 'Correct test commit' );
  38 +
47 t/create_repo.t
... ... @@ -1,47 +0,0 @@
1   -#!perl
2   -
3   -use strict;
4   -use warnings;
5   -
6   -use Gup;
7   -use Test::More tests => 9;
8   -use Test::Fatal 'exception';
9   -use Test::File;
10   -use t::lib::Functions;
11   -
12   -my $dir = t::lib::Functions::create_test_dir;
13   -my $gup = Gup->new( name => 'test', repos_dir => $dir );
14   -
15   -isa_ok( $gup, 'Gup' );
16   -can_ok( $gup, 'create_repo' );
17   -
18   -# get repo object and repo dir
19   -my $repo = $gup->create_repo;
20   -my $repo_dir = $gup->repo_dir;
21   -
22   -isa_ok( $repo, 'Git::Repository' );
23   -
24   -my $file = t::lib::Functions::create_test_file($repo_dir);
25   -diag("Created temp dir $dir");
26   -
27   -dir_exists_ok(
28   - $repo_dir,
29   - 'test repo dir exists',
30   -);
31   -
32   -dir_exists_ok(
33   - File::Spec->catdir( $repo_dir, '.git' ),
34   - 'test repo .git dir exists',
35   -);
36   -
37   -file_exists_ok( $file, "Repo test file $file created" );
38   -file_contains_like( $file, qr/this is a test line/, 'Correct output' );
39   -
40   -$repo->run( 'add', $file );
41   -$repo->run( 'commit', '-m', 'test commit' );
42   -
43   -my $output = $repo->run('log');
44   -
45   -like( $output, qr/Initial commit/, 'Correct initial commit' );
46   -like( $output, qr/test commit/ , 'Correct test commit' );
47   -

0 comments on commit 95f3919

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