diff options
Diffstat (limited to 'spec/requests/api/lint_spec.rb')
-rw-r--r-- | spec/requests/api/lint_spec.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/requests/api/lint_spec.rb b/spec/requests/api/lint_spec.rb index 0e83b964121..7c1e731a99a 100644 --- a/spec/requests/api/lint_spec.rb +++ b/spec/requests/api/lint_spec.rb @@ -121,8 +121,8 @@ RSpec.describe API::Lint do expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Hash expect(json_response['status']).to eq('valid') - expect(json_response['warnings']).to eq([]) - expect(json_response['errors']).to eq([]) + expect(json_response['warnings']).to match_array([]) + expect(json_response['errors']).to match_array([]) end it 'outputs expanded yaml content' do @@ -149,7 +149,20 @@ RSpec.describe API::Lint do expect(response).to have_gitlab_http_status(:ok) expect(json_response['status']).to eq('valid') expect(json_response['warnings']).not_to be_empty - expect(json_response['errors']).to eq([]) + expect(json_response['errors']).to match_array([]) + end + end + + context 'with valid .gitlab-ci.yaml using deprecated keywords' do + let(:yaml_content) { { job: { script: 'ls' }, types: ['test'] }.to_yaml } + + it 'passes validation but returns warnings' do + post api('/ci/lint', api_user), params: { content: yaml_content } + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['status']).to eq('valid') + expect(json_response['warnings']).not_to be_empty + expect(json_response['errors']).to match_array([]) end end |