added commits page tests and commit page branch automat...
...ically get
... | ... |
@@ -4,7 +4,7 @@ |
4 | 4 |
<meta charset="UTF-8"> |
5 | 5 |
<meta name="robots" content="index, nofollow" > |
6 | 6 |
<title>GitPrep</title> |
7 |
- %= stylesheet '/css/bootstrap.css'; |
|
7 |
+ %= stylesheet '/css/bootstrap.css', rel => 'stylesheet', media => 'screen'; |
|
8 | 8 |
%= stylesheet '/js/google-code-prettify/prettify.css'; |
9 | 9 |
%= stylesheet '/css/common.css'; |
10 | 10 |
%= javascript '/js/jquery-1.9.0.min.js'; |
... | ... |
@@ -3,17 +3,14 @@ |
3 | 3 |
|
4 | 4 |
# API |
5 | 5 |
my $api = gitprep_api; |
6 |
- |
|
7 |
- # Default revision |
|
8 |
- my $rev = 'master'; |
|
6 |
+ |
|
7 |
+ # Git |
|
8 |
+ my $git = app->git; |
|
9 | 9 |
|
10 | 10 |
# Parameters |
11 | 11 |
my $user = param('user'); |
12 | 12 |
my $project = param('project'); |
13 |
- my $object ||= param('object') || 'master/'; |
|
14 |
- |
|
15 |
- # Git |
|
16 |
- my $git = app->git; |
|
13 |
+ my $rev = app->manager->default_branch($user, $project); |
|
17 | 14 |
|
18 | 15 |
# Repository description |
19 | 16 |
my $desc = $git->description($user, $project); |
... | ... |
@@ -23,7 +20,7 @@ |
23 | 20 |
my $readme; |
24 | 21 |
if ($git->branch_exists($user, $project)) { |
25 | 22 |
# Id and directory |
26 |
- my ($id, $dir) = @{$git->parse_object($user, $project, $object)}; |
|
23 |
+ my ($id, $dir) = @{$git->parse_object($user, $project, "$rev/")}; |
|
27 | 24 |
|
28 | 25 |
# Tree id |
29 | 26 |
my $tid; |
... | ... |
@@ -39,5 +39,13 @@ diag 'Commit page - first commit'; |
39 | 39 |
|
40 | 40 |
# Empty file is added |
41 | 41 |
$t->content_like(qr/No changes/); |
42 |
-}; |
|
42 |
+} |
|
43 | 43 |
|
44 |
+diag 'Commits page'; |
|
45 |
+{ |
|
46 |
+ # Page access |
|
47 |
+ $t->get_ok("/$user/$project/commits/master"); |
|
48 |
+ |
|
49 |
+ # Date |
|
50 |
+ $t->content_like(qr/\d{4}-\d{2}-\d{3}/); |
|
51 |
+} |