BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
134ba0b5
Commit
134ba0b5
authored
Jun 22, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm-tree-json' of gitlab.com:gitlab-org/gitlab-ce into dm-tree-json
parents
f516b8d0
4b962efc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
renders_blob.rb
app/controllers/concerns/renders_blob.rb
+5
-1
blob_controller_spec.rb
spec/controllers/projects/blob_controller_spec.rb
+20
-0
No files found.
app/controllers/concerns/renders_blob.rb
View file @
134ba0b5
...
...
@@ -14,7 +14,11 @@ module RendersBlob
return
render_404
unless
viewer
render
json:
{
html:
view_to_html_string
(
"projects/blob/_viewer"
,
viewer:
viewer
,
load_async:
false
)
html:
view_to_html_string
(
"projects/blob/_viewer"
,
viewer:
viewer
,
load_async:
false
),
plain:
blob
.
data
,
name:
blob
.
name
,
size:
blob
.
size
,
mime_type:
blob
.
mime_type
}
end
...
...
spec/controllers/projects/blob_controller_spec.rb
View file @
134ba0b5
...
...
@@ -35,6 +35,26 @@ describe Projects::BlobController do
end
end
context
'with file path and JSON format'
do
context
"valid branch, valid file"
do
let
(
:id
)
{
'master/README.md'
}
before
do
get
(
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
id
,
format: :json
)
end
it
do
expect
(
response
).
to
be_ok
expect
(
json_response
).
to
have_key
'html'
expect
(
json_response
).
to
have_key
'plain'
end
end
end
context
'with tree path'
do
before
do
get
(
:show
,
...
...
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