diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/requests/api/lint_spec.rb | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/requests/api/lint_spec.rb')
-rw-r--r-- | spec/requests/api/lint_spec.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/spec/requests/api/lint_spec.rb b/spec/requests/api/lint_spec.rb index 7c1e731a99a..73bc4a5d1f3 100644 --- a/spec/requests/api/lint_spec.rb +++ b/spec/requests/api/lint_spec.rb @@ -110,7 +110,7 @@ RSpec.describe API::Lint do context 'when authenticated' do let_it_be(:api_user) { create(:user) } - context 'with valid .gitlab-ci.yaml content' do + context 'with valid .gitlab-ci.yml content' do let(:yaml_content) do File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) end @@ -140,7 +140,7 @@ RSpec.describe API::Lint do end end - context 'with valid .gitlab-ci.yaml with warnings' do + context 'with valid .gitlab-ci.yml with warnings' do let(:yaml_content) { { job: { script: 'ls', rules: [{ when: 'always' }] } }.to_yaml } it 'passes validation but returns warnings' do @@ -153,8 +153,8 @@ RSpec.describe API::Lint do end end - context 'with valid .gitlab-ci.yaml using deprecated keywords' do - let(:yaml_content) { { job: { script: 'ls' }, types: ['test'] }.to_yaml } + context 'with valid .gitlab-ci.yml using deprecated keywords' do + let(:yaml_content) { { job: { script: 'ls', type: 'test' }, types: ['test'] }.to_yaml } it 'passes validation but returns warnings' do post api('/ci/lint', api_user), params: { content: yaml_content } @@ -166,7 +166,7 @@ RSpec.describe API::Lint do end end - context 'with an invalid .gitlab_ci.yml' do + context 'with an invalid .gitlab-ci.yml' do context 'with invalid syntax' do let(:yaml_content) { 'invalid content' } @@ -384,6 +384,15 @@ RSpec.describe API::Lint do project.add_developer(api_user) end + context 'with no commit' do + it 'returns error about providing content' do + ci_lint + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['errors']).to match_array(['Please provide content of .gitlab-ci.yml']) + end + end + context 'with valid .gitlab-ci.yml content' do let(:yaml_content) do { include: { local: 'another-gitlab-ci.yml' }, test: { stage: 'test', script: 'echo 1' } }.to_yaml |