BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
de2e8d4a
Commit
de2e8d4a
authored
Aug 24, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for yaml content with errors
parent
ca1f5ede
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
lint_spec.rb
spec/requests/api/lint_spec.rb
+12
-6
No files found.
spec/requests/api/lint_spec.rb
View file @
de2e8d4a
...
...
@@ -3,15 +3,13 @@ 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
it
'validates content'
do
post
api
(
'/lint'
),
{
content:
yaml_content
}
expect
(
response
).
to
have_http_status
(
200
)
...
...
@@ -19,14 +17,22 @@ describe API::API do
expect
(
json_response
[
'status'
]).
to
eq
(
'valid'
)
end
end
end
context
'with invalid .gitlab_ci.yml
content
'
do
it
'validate
content
'
do
context
'with invalid .gitlab_ci.yml'
do
it
'validate
s content and shows correct errors
'
do
post
api
(
'/lint'
),
{
content:
'invalid content'
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'status'
]).
to
eq
(
'invalid'
)
expect
(
json_response
[
'errors'
]).
to
eq
([
'Invalid configuration format'
])
end
it
"validates content and shows configuration error"
do
post
api
(
'/lint'
),
{
content:
'{ image: "ruby:2.1", services: ["postgres"] }'
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'status'
]).
to
eq
(
'invalid'
)
expect
(
json_response
[
'errors'
]).
to
eq
([
'jobs config should contain at least one visible job'
])
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment