BigW Consortium Gitlab

Commit 134ba0b5 by Dmitriy Zaporozhets

Merge branch 'dm-tree-json' of gitlab.com:gitlab-org/gitlab-ce into dm-tree-json

parents f516b8d0 4b962efc
......@@ -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
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment