summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-10-12 18:38:02 +0000
committerRobert Speicher <robert@gitlab.com>2016-10-12 18:38:02 +0000
commit58e2b44afe535100508eb4d49d7e7df24e408383 (patch)
tree297acd474db338de3de6290543e8f14bbe2c4252 /spec/requests/api
parent5aa7b13c2ed61f22aa3be48b2ad5fe2ed6ea3a5e (diff)
parentb998479c81512b7c9a2cff28e7aabff3c4be0424 (diff)
downloadgitlab-ce-58e2b44afe535100508eb4d49d7e7df24e408383.tar.gz
Merge branch 'api-version' into 'master'
API: Version information ## What does this MR do? Adds a new endpoint to retrieve the version information. ## Why was this MR needed? Clients can now use this information to enable/disable certain API features depending on the version. ## What are the relevant issue numbers? Closes #22608, https://gitlab.com/gitlab-org/gitlab-ce/issues/23148 See merge request !6822
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/version_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/requests/api/version_spec.rb b/spec/requests/api/version_spec.rb
new file mode 100644
index 00000000000..54b69a0cae7
--- /dev/null
+++ b/spec/requests/api/version_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe API::API, api: true do
+ include ApiHelpers
+
+ describe 'GET /version' do
+ context 'when unauthenticated' do
+ it 'returns authentication error' do
+ get api('/version')
+
+ expect(response).to have_http_status(401)
+ end
+ end
+
+ context 'when authenticated' do
+ let(:user) { create(:user) }
+
+ it 'returns the version information' do
+ get api('/version', user)
+
+ expect(response).to have_http_status(200)
+ expect(json_response['version']).to eq(Gitlab::VERSION)
+ expect(json_response['revision']).to eq(Gitlab::REVISION)
+ end
+ end
+ end
+end