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

added refs_controller_spec

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