diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-10 15:18:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-10 15:18:48 +0300 |
commit | 190128fc72e015c383e7a96c128276d1833f3beb (patch) | |
tree | c9defcce34e8e0661c3a2cebe78847e9d9f14a39 /spec/requests/api/lint_spec.rb | |
parent | de74d20b2596c8d27987744d24a7fc09fbe8ff37 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/lint_spec.rb')
-rw-r--r-- | spec/requests/api/lint_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/requests/api/lint_spec.rb b/spec/requests/api/lint_spec.rb index abb8948f13a..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,7 +153,7 @@ RSpec.describe API::Lint do end end - context 'with valid .gitlab-ci.yaml using deprecated keywords' do + 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 @@ -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 |