Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
dfeef6c2
Commit
dfeef6c2
authored
Apr 03, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed API file raw functionality, Fixed tree controller tests. Added BlobController specs
parent
413a310f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
31 deletions
+67
-31
app/views/tree/_tree.html.haml
app/views/tree/_tree.html.haml
+18
-21
lib/api/projects.rb
lib/api/projects.rb
+7
-5
spec/controllers/blob_controller_spec.rb
spec/controllers/blob_controller_spec.rb
+37
-0
spec/controllers/tree_controller_spec.rb
spec/controllers/tree_controller_spec.rb
+3
-3
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+2
-2
No files found.
app/views/tree/_tree.html.haml
View file @
dfeef6c2
...
@@ -12,9 +12,6 @@
...
@@ -12,9 +12,6 @@
=
link_to
title
,
'#'
=
link_to
title
,
'#'
%div
#tree-content-holder
.tree-content-holder
%div
#tree-content-holder
.tree-content-holder
-
if
tree
.
is_blob?
=
render
"tree/blob"
,
blob:
tree
-
else
%table
#tree-slider
{
class:
"table_#{@hex_path} tree-table"
}
%table
#tree-slider
{
class:
"table_#{@hex_path} tree-table"
}
%thead
%thead
%tr
%tr
...
...
lib/api/projects.rb
View file @
dfeef6c2
...
@@ -493,14 +493,16 @@ module Gitlab
...
@@ -493,14 +493,16 @@ module Gitlab
ref
=
params
[
:sha
]
ref
=
params
[
:sha
]
commit
=
user_project
.
repository
.
commit
ref
repo
=
user_project
.
repository
commit
=
repo
.
commit
(
ref
)
not_found!
"Commit"
unless
commit
not_found!
"Commit"
unless
commit
tree
=
Tree
.
new
commit
.
tree
,
ref
,
params
[
:filepath
]
blob
=
Gitlab
::
Git
::
Blob
.
new
(
repo
,
commit
.
id
,
ref
,
params
[
:filepath
])
not_found!
"File"
unless
tree
.
try
(
:tree
)
not_found!
"File"
unless
blob
.
exists?
content_type
tree
.
mime_type
content_type
blob
.
mime_type
present
tree
.
data
present
blob
.
data
end
end
# Get a specific project's keys
# Get a specific project's keys
...
...
spec/controllers/blob_controller_spec.rb
0 → 100644
View file @
dfeef6c2
require
'spec_helper'
describe
BlobController
do
let
(
:project
)
{
create
(
:project_with_code
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:master
]
project
.
stub
(
:branches
).
and_return
([
'master'
,
'foo/bar/baz'
])
project
.
stub
(
:tags
).
and_return
([
'v1.0.0'
,
'v2.0.0'
])
controller
.
instance_variable_set
(
:@project
,
project
)
end
describe
"GET show"
do
render_views
before
{
get
:show
,
project_id:
project
.
code
,
id:
id
}
context
"valid branch, valid file"
do
let
(
:id
)
{
'master/README.md'
}
it
{
should
respond_with
(
:success
)
}
end
context
"valid branch, invalid file"
do
let
(
:id
)
{
'master/invalid-path.rb'
}
it
{
should
respond_with
(
:not_found
)
}
end
context
"invalid branch, valid file"
do
let
(
:id
)
{
'invalid-branch/README.md'
}
it
{
should
respond_with
(
:not_found
)
}
end
end
end
spec/controllers/tree_controller_spec.rb
View file @
dfeef6c2
...
@@ -26,17 +26,17 @@ describe TreeController do
...
@@ -26,17 +26,17 @@ describe TreeController do
end
end
context
"valid branch, valid path"
do
context
"valid branch, valid path"
do
let
(
:id
)
{
'master/
README.md
'
}
let
(
:id
)
{
'master/
app/
'
}
it
{
should
respond_with
(
:success
)
}
it
{
should
respond_with
(
:success
)
}
end
end
context
"valid branch, invalid path"
do
context
"valid branch, invalid path"
do
let
(
:id
)
{
'master/invalid-path
.rb
'
}
let
(
:id
)
{
'master/invalid-path
/
'
}
it
{
should
respond_with
(
:not_found
)
}
it
{
should
respond_with
(
:not_found
)
}
end
end
context
"invalid branch, valid path"
do
context
"invalid branch, valid path"
do
let
(
:id
)
{
'invalid-branch/
README.md
'
}
let
(
:id
)
{
'invalid-branch/
app/
'
}
it
{
should
respond_with
(
:not_found
)
}
it
{
should
respond_with
(
:not_found
)
}
end
end
end
end
...
...
spec/models/commit_spec.rb
View file @
dfeef6c2
...
@@ -38,10 +38,10 @@ describe Commit do
...
@@ -38,10 +38,10 @@ describe Commit do
it
{
should
respond_to
(
:message
)
}
it
{
should
respond_to
(
:message
)
}
it
{
should
respond_to
(
:authored_date
)
}
it
{
should
respond_to
(
:authored_date
)
}
it
{
should
respond_to
(
:committed_date
)
}
it
{
should
respond_to
(
:committed_date
)
}
it
{
should
respond_to
(
:committer_email
)
}
it
{
should
respond_to
(
:author_email
)
}
it
{
should
respond_to
(
:parents
)
}
it
{
should
respond_to
(
:parents
)
}
it
{
should
respond_to
(
:date
)
}
it
{
should
respond_to
(
:date
)
}
it
{
should
respond_to
(
:committer
)
}
it
{
should
respond_to
(
:author
)
}
it
{
should
respond_to
(
:diffs
)
}
it
{
should
respond_to
(
:diffs
)
}
it
{
should
respond_to
(
:tree
)
}
it
{
should
respond_to
(
:tree
)
}
it
{
should
respond_to
(
:id
)
}
it
{
should
respond_to
(
:id
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment