Commit 46e0a66a authored by Phil Hughes's avatar Phil Hughes

added refs_controller_spec

parent 5a2d9f66
......@@ -19,16 +19,19 @@ describe Projects::RefsController do
format: format
end
def xhr_get(format = :html)
def xhr_get(format = :html, path = 'foo/bar/baz.html')
xhr :get,
:logs_tree,
namespace_id: project.namespace.to_param,
project_id: project, id: 'master',
path: 'foo/bar/baz.html', format: format
project_id: project,
id: 'master',
path: path,
format: format
end
it 'never throws MissingTemplate' do
expect { default_get }.not_to raise_error
expect { xhr_get(:json) }.not_to raise_error
expect { xhr_get }.not_to raise_error
end
......@@ -42,5 +45,14 @@ describe Projects::RefsController do
xhr_get(:js)
expect(response).to be_success
end
it 'renders JSON' do
xhr_get(:json, '/')
expect(response).to be_success
expect(json_response).to be_kind_of(Array)
expect(json_response[0]['type']).to eq('tree')
expect(json_response[0]['file_name']).to eq('bar')
end
end
end
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