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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
4b962efc
Commit
4b962efc
authored
Jun 15, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add extra data for RenderBlob json
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
2ae9c890
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
app/controllers/concerns/renders_blob.rb
app/controllers/concerns/renders_blob.rb
+5
-1
spec/controllers/projects/blob_controller_spec.rb
spec/controllers/projects/blob_controller_spec.rb
+20
-0
No files found.
app/controllers/concerns/renders_blob.rb
View file @
4b962efc
...
@@ -14,7 +14,11 @@ module RendersBlob
...
@@ -14,7 +14,11 @@ module RendersBlob
return
render_404
unless
viewer
return
render_404
unless
viewer
render
json:
{
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
end
...
...
spec/controllers/projects/blob_controller_spec.rb
View file @
4b962efc
...
@@ -35,6 +35,26 @@ describe Projects::BlobController do
...
@@ -35,6 +35,26 @@ describe Projects::BlobController do
end
end
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
context
'with tree path'
do
before
do
before
do
get
(
:show
,
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