Skip to content
Browse files

Refactor create repo dir

  • Loading branch information...
1 parent 6349dde commit 95f3919707929bf0e116ea6034eba32e88a187cf @R3VoLuT1OneR R3VoLuT1OneR committed May 4, 2012
Showing with 38 additions and 47 deletions.
  1. +38 −0 t/05_create_repo.t
  2. +0 −47 t/create_repo.t
View
38 t/05_create_repo.t
@@ -0,0 +1,38 @@
+use strict;
+use warnings;
+use Test::More tests => 7;
+use Test::File;
+use t::lib::Functions;
+
+use Gup;
+
+my $dir = File::Spec->catdir( t::lib::Functions::create_test_dir, 'test_gup' );
+my $gup = Gup->new( repo_dir => $dir );
+
+$gup->create_repo;
+
+isa_ok( $gup->repo, 'Git::Repository' );
+
+my $file = t::lib::Functions::create_test_file($dir);
+
+dir_exists_ok(
+ $dir,
+ 'test repo dir exists',
+);
+
+dir_exists_ok(
+ File::Spec->catdir( $dir, '.git' ),
+ 'test repo .git dir exists',
+);
+
+file_exists_ok( $file, "Repo test file $file created" );
+file_contains_like( $file, qr/this is a test line/, 'Correct output' );
+
+$gup->repo->run( 'add', $file );
+$gup->repo->run( 'commit', '-m', 'test commit' );
+
+my $output = $gup->repo->run('log');
+
+like( $output, qr/Initial commit/, 'Correct initial commit' );
+like( $output, qr/test commit/ , 'Correct test commit' );
+
View
47 t/create_repo.t
@@ -1,47 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use Gup;
-use Test::More tests => 9;
-use Test::Fatal 'exception';
-use Test::File;
-use t::lib::Functions;
-
-my $dir = t::lib::Functions::create_test_dir;
-my $gup = Gup->new( name => 'test', repos_dir => $dir );
-
-isa_ok( $gup, 'Gup' );
-can_ok( $gup, 'create_repo' );
-
-# get repo object and repo dir
-my $repo = $gup->create_repo;
-my $repo_dir = $gup->repo_dir;
-
-isa_ok( $repo, 'Git::Repository' );
-
-my $file = t::lib::Functions::create_test_file($repo_dir);
-diag("Created temp dir $dir");
-
-dir_exists_ok(
- $repo_dir,
- 'test repo dir exists',
-);
-
-dir_exists_ok(
- File::Spec->catdir( $repo_dir, '.git' ),
- 'test repo .git dir exists',
-);
-
-file_exists_ok( $file, "Repo test file $file created" );
-file_contains_like( $file, qr/this is a test line/, 'Correct output' );
-
-$repo->run( 'add', $file );
-$repo->run( 'commit', '-m', 'test commit' );
-
-my $output = $repo->run('log');
-
-like( $output, qr/Initial commit/, 'Correct initial commit' );
-like( $output, qr/test commit/ , 'Correct test commit' );
-

0 comments on commit 95f3919

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