blob: 9de9c90a4aa3a8bcbfd088281792263b450f71a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
require 'spec_helper'
describe API::API do
include ApiHelpers
let(:user) { create(:user) }
let(:yaml_content) do
File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
end
describe 'POST /lint' do
context 'with valid .gitlab-ci.yaml content' do
context 'authorized user' do
it 'validate content' do
post api('/lint'), { content: yaml_content }
expect(response).to have_http_status(200)
expect(json_response).to be_an Hash
expect(json_response['status']).to eq('valid')
end
end
end
context 'with invalid .gitlab_ci.yml content' do
it 'validate content' do
post api('/lint'), { content: 'invalid content' }
expect(response).to have_http_status(200)
expect(json_response['status']).to eq('invalid')
end
end
context 'no content parameters' do
it 'shows error message' do
post api('/lint')
expect(response).to have_http_status(400)
end
end
end
end
|