diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-06-02 18:20:08 +0200 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-20 14:48:28 -0500 |
commit | 620d014aefd23030ed6ae043e223ccc5dc52fc8a (patch) | |
tree | 9324f2cbb23bdcc4f02d9b29b349894e4b43ac8c /spec | |
parent | 567f6a7b4271d97afd6dea1545210b9aba858421 (diff) | |
download | gitlab-ce-620d014aefd23030ed6ae043e223ccc5dc52fc8a.tar.gz |
Implement backend gitlab ci dropdown
This commit builds on the groundwork in
ee008e300b1ec0abcc90e6a30816ec0754cea0dd, which refactored the backend
so the same code could be used for new dropdowns. In this commit its
used for templates for the `.gitlab-ci.yml` files.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/gitignores_spec.rb | 29 | ||||
-rw-r--r-- | spec/requests/api/templates_spec.rb | 43 |
2 files changed, 43 insertions, 29 deletions
diff --git a/spec/requests/api/gitignores_spec.rb b/spec/requests/api/gitignores_spec.rb deleted file mode 100644 index 9130312c057..00000000000 --- a/spec/requests/api/gitignores_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'spec_helper' - -describe API::Templates, api: true do - include ApiHelpers - - describe 'Entity Gitignore' do - before { get api('/gitignores/Ruby') } - - it { expect(json_response['name']).to eq('Ruby') } - it { expect(json_response['content']).to include('*.gem') } - end - - describe 'Entity GitignoresList' do - before { get api('/gitignores') } - - it { expect(json_response.first['name']).not_to be_nil } - it { expect(json_response.first['content']).to be_nil } - end - - describe 'GET /gitignores' do - it 'returns a list of available license templates' do - get api('/gitignores') - - expect(response.status).to eq(200) - expect(json_response).to be_an Array - expect(json_response.size).to be > 15 - end - end -end diff --git a/spec/requests/api/templates_spec.rb b/spec/requests/api/templates_spec.rb new file mode 100644 index 00000000000..0e9a28b1ff6 --- /dev/null +++ b/spec/requests/api/templates_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +describe API::Templates, api: true do + include ApiHelpers + + describe 'the Template Entity' do + before { get api('/gitignores/Ruby') } + + it { expect(json_response['name']).to eq('Ruby') } + it { expect(json_response['content']).to include('*.gem') } + end + + describe 'the TemplateList Entity' do + before { get api('/gitignores') } + + it { expect(json_response.first['name']).not_to be_nil } + it { expect(json_response.first['content']).to be_nil } + end + + context 'requesting gitignores' do + describe 'GET /gitignores' do + it 'returns a list of available gitignore templates' do + get api('/gitignores') + + expect(response.status).to eq(200) + expect(json_response).to be_an Array + expect(json_response.size).to be > 15 + end + end + end + + context 'requesting gitlab-ci-ymls' do + describe 'GET /gitlab_ci_ymls' do + it 'returns a list of available gitlab_ci_ymls' do + get api('/gitlab_ci_ymls') + + expect(response.status).to eq(200) + expect(json_response).to be_an Array + expect(json_response.first['name']).not_to be_nil + end + end + end +end |