summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-07-11 16:05:06 +0100
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-07-12 16:36:42 +0100
commitc4dc0f52c3fbb0b195a23645ebdc78991abb332d (patch)
treeb11dfb4018feb382d4b56d7b6e44eac9b321ccc0 /spec
parentf0c437ca7d5ece265b134d8323f4f01b656f1a90 (diff)
downloadgitlab-ce-c4dc0f52c3fbb0b195a23645ebdc78991abb332d.tar.gz
adds test to check json fields on simple request and changes the url request format
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/project_title_spec.js.coffee2
-rw-r--r--spec/requests/api/projects_spec.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/spec/javascripts/project_title_spec.js.coffee b/spec/javascripts/project_title_spec.js.coffee
index e49dfbf1ba4..0244119fa0e 100644
--- a/spec/javascripts/project_title_spec.js.coffee
+++ b/spec/javascripts/project_title_spec.js.coffee
@@ -22,7 +22,7 @@ describe 'Project Title', ->
@projects_data = fixture.load('projects.json')[0]
spyOn(jQuery, 'ajax').and.callFake (req) =>
- expect(req.url).toBe('/api/v3/projects.json?format=simple')
+ expect(req.url).toBe('/api/v3/projects.json?simple=true')
d = $.Deferred()
d.resolve @projects_data
d.promise()
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 8a52725a893..2a0b56c5052 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -81,6 +81,16 @@ describe API::API, api: true do
expect(json_response.first.keys).not_to include('open_issues_count')
end
+ context 'GET /projects?simple=true' do
+ let(:keys) { ["id", "http_url_to_repo", "web_url", "name", "name_with_namespace", "path", "path_with_namespace", "permissions"] }
+ it 'should return a simplified version of all the projects' do
+ get api('/projects?simple=true', user)
+ expect(response).to have_http_status(200)
+ expect(json_response).to be_an Array
+ expect(json_response.first.keys).to match_array keys
+ end
+ end
+
context 'and using search' do
it 'should return searched project' do
get api('/projects', user), { search: project.name }