Bootstrap test fixes.
[catagits/Gitalist.git] / t / 02git_tag.t
1 use FindBin qw/$Bin/;
2 BEGIN {
3     my $env = "$FindBin::Bin/../script/env";
4     if (-r $env) {
5         do $env or die $@;
6     }
7 }
8 use strict;
9 use warnings;
10 use Test::More qw/no_plan/;
11 use Test::Exception;
12 use Data::Dumper;
13
14 BEGIN { use_ok 'Gitalist::Git::Tag' }
15
16 # Create an instance from for-each-ref output
17 my $revline="36c6c6708b8360d7023e8a1649c45bcf9b3bd818 commit refs/tags/0.01   add dir1/file2\0Florian Ragwitz <rafl\@debian.org> 1173210275 +0100";
18 #my $revline="a92fb1c9282f7319099ce7f783c8be7d5360f6e3\0refs/heads/model-cleanup\0Zachary Stevens <zts\@cryptocracy.com> 1277601094 +0100";
19 my $instance = Gitalist::Git::Tag->new($revline);
20 isa_ok($instance, 'Gitalist::Git::Tag');
21
22 # Create an instance, passing last_change as a DateTime
23 use DateTime;
24 my $timespec = [1173210275, '+0100'];
25 my $dt = DateTime->from_epoch(
26     epoch => @$timespec[0],
27     time_zone => @$timespec[1],
28 );
29 my $head = Gitalist::Git::Tag->new(
30     sha1 => '36c6c6708b8360d7023e8a1649c45bcf9b3bd818',
31     name => '0.01',
32     type => 'commit',
33     committer => 'Florian Ragwitz <rafl@debian.org>',
34     last_change => $dt,
35 );
36 isa_ok($head, 'Gitalist::Git::Tag');