... | ... |
@@ -49,16 +49,14 @@ sub startup { |
49 | 49 |
} |
50 | 50 |
$git->bin($git_bin); |
51 | 51 |
|
52 |
- # Added public path |
|
53 |
- push @{$self->static->paths}, $self->home->rel_file('data/rep'); |
|
54 |
- |
|
55 | 52 |
# Repository Manager |
56 | 53 |
my $manager = Gitprep::RepManager->new(app => $self); |
57 | 54 |
weaken $manager->{app}; |
58 | 55 |
$self->manager($manager); |
59 | 56 |
|
60 | 57 |
# Repository home |
61 |
- my $rep_home = $self->home->rel_file('data/rep'); |
|
58 |
+ my $rep_home = $ENV{GITPREP_REP_HOME} |
|
59 |
+ || $self->home->rel_file('data/rep'); |
|
62 | 60 |
$git->rep_home($rep_home); |
63 | 61 |
unless (-d $rep_home) { |
64 | 62 |
mkdir $rep_home |
... | ... |
@@ -66,8 +64,12 @@ sub startup { |
66 | 64 |
} |
67 | 65 |
$self->git($git); |
68 | 66 |
|
67 |
+ # Added public path |
|
68 |
+ push @{$self->static->paths}, $rep_home; |
|
69 |
+ |
|
69 | 70 |
# DBI |
70 |
- my $db_file = $self->home->rel_file('data/gitprep.db'); |
|
71 |
+ my $db_file = $ENV{GITPREP_DB_FILE} |
|
72 |
+ || $self->home->rel_file('data/gitprep.db'); |
|
71 | 73 |
my $dbi = DBIx::Custom->connect( |
72 | 74 |
dsn => "dbi:SQLite:database=$db_file", |
73 | 75 |
connector => 1, |
... | ... |
@@ -6,6 +6,13 @@ use lib "$FindBin::Bin/../lib"; |
6 | 6 |
use lib "$FindBin::Bin/../extlib/lib/perl5"; |
7 | 7 |
|
8 | 8 |
use Test::Mojo; |
9 |
+ |
|
10 |
+# Test DB |
|
11 |
+$ENV{GITPREP_DB_FILE} = "$FindBin::Bin/basic.db"; |
|
12 |
+ |
|
13 |
+# Test Repository home |
|
14 |
+$ENV{GITPREP_REP_HOME} = "$FindBin::Bin/../../gitprep_t_rep_home"; |
|
15 |
+ |
|
9 | 16 |
use Gitprep; |
10 | 17 |
|
11 | 18 |
my $app = Gitprep->new; |
... | ... |
@@ -14,7 +21,50 @@ my $t = Test::Mojo->new($app); |
14 | 21 |
my $user = 'kimoto'; |
15 | 22 |
my $project = 'gitprep_t'; |
16 | 23 |
|
17 |
-diag 'Commit page - first commit'; |
|
24 |
+note 'Home page'; |
|
25 |
+{ |
|
26 |
+ # Page access |
|
27 |
+ $t->get_ok('/'); |
|
28 |
+ |
|
29 |
+ # Title |
|
30 |
+ $t->content_like(qr/GitPrep/); |
|
31 |
+ $t->content_like(qr/Users/); |
|
32 |
+ |
|
33 |
+ # User link |
|
34 |
+ $t->content_like(qr#/$user#); |
|
35 |
+} |
|
36 |
+ |
|
37 |
+note 'Projects page'; |
|
38 |
+{ |
|
39 |
+ # Page access |
|
40 |
+ $t->get_ok("/$user"); |
|
41 |
+ |
|
42 |
+ # Title |
|
43 |
+ $t->content_like(qr/Repositories/); |
|
44 |
+ |
|
45 |
+ # project link |
|
46 |
+ $t->content_like(qr#/$user/$project#); |
|
47 |
+} |
|
48 |
+ |
|
49 |
+note 'Project page'; |
|
50 |
+{ |
|
51 |
+ # Page access |
|
52 |
+ $t->get_ok("/$user/$project"); |
|
53 |
+ |
|
54 |
+ # Description |
|
55 |
+ $t->content_like(qr/gitprep test repository/); |
|
56 |
+ |
|
57 |
+ # README |
|
58 |
+ $t->content_like(qr/README/); |
|
59 |
+ |
|
60 |
+ # tree directory link |
|
61 |
+ $t->content_like(qr#/$user/$project/tree/master/dir#); |
|
62 |
+ |
|
63 |
+ # tree file link |
|
64 |
+ $t->content_like(qr#/$user/$project/blob/master/README#); |
|
65 |
+} |
|
66 |
+ |
|
67 |
+note 'Commit page - first commit'; |
|
18 | 68 |
{ |
19 | 69 |
# Page access |
20 | 70 |
$t->get_ok("/$user/$project/commit/4b0e81c462088b16fefbe545e00b993fd7e6f884"); |
... | ... |
@@ -41,11 +91,11 @@ diag 'Commit page - first commit'; |
41 | 91 |
$t->content_like(qr/No changes/); |
42 | 92 |
} |
43 | 93 |
|
44 |
-diag 'Commits page'; |
|
94 |
+note 'Commits page'; |
|
45 | 95 |
{ |
46 | 96 |
# Page access |
47 | 97 |
$t->get_ok("/$user/$project/commits/master"); |
48 | 98 |
|
49 | 99 |
# Date |
50 |
- $t->content_like(qr/\d{4}-\d{2}-\d{3}/); |
|
100 |
+ $t->content_like(qr/\d{4}-\d{2}-\d{2}/); |
|
51 | 101 |
} |