diff options
| author | Robert Schilling <rschilling@student.tugraz.at> | 2016-10-12 13:32:48 +0200 |
|---|---|---|
| committer | Robert Schilling <rschilling@student.tugraz.at> | 2016-10-12 16:47:35 +0200 |
| commit | b998479c81512b7c9a2cff28e7aabff3c4be0424 (patch) | |
| tree | bb6ad3e585b1096f804dc354eebabb68bf93b9ec /spec | |
| parent | 7c07c07d7a2b93ab81964b9cd28736652da1370a (diff) | |
| download | gitlab-ce-api-version.tar.gz | |
API: Version informationapi-version
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/requests/api/version_spec.rb | 27 |
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 |
