Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
9ba72378
Commit
9ba72378
authored
May 06, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor CI API specs for creating runner
parent
b253aa32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
spec/requests/ci/api/runners_spec.rb
spec/requests/ci/api/runners_spec.rb
+29
-17
No files found.
spec/requests/ci/api/runners_spec.rb
View file @
9ba72378
...
...
@@ -12,45 +12,57 @@ describe Ci::API::API do
end
describe
"POST /runners/register"
do
describe
"should create a runner if token provided"
do
context
'when runner token is provided'
do
before
{
post
ci_api
(
"/runners/register"
),
token:
registration_token
}
it
{
expect
(
response
.
status
).
to
eq
(
201
)
}
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
end
end
describe
"should create a runner with description"
do
context
'when runner description is provided'
do
before
{
post
ci_api
(
"/runners/register"
),
token:
registration_token
,
description:
"server.hostname"
}
it
{
expect
(
response
.
status
).
to
eq
(
201
)
}
it
{
expect
(
Ci
::
Runner
.
first
.
description
).
to
eq
(
"server.hostname"
)
}
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
Ci
::
Runner
.
first
.
description
).
to
eq
(
"server.hostname"
)
end
end
describe
"should create a runner with tags"
do
context
'when runner tags are provided'
do
before
{
post
ci_api
(
"/runners/register"
),
token:
registration_token
,
tag_list:
"tag1, tag2"
}
it
{
expect
(
response
.
status
).
to
eq
(
201
)
}
it
{
expect
(
Ci
::
Runner
.
first
.
tag_list
.
sort
).
to
eq
([
"tag1"
,
"tag2"
])
}
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
Ci
::
Runner
.
first
.
tag_list
.
sort
).
to
eq
([
"tag1"
,
"tag2"
])
end
end
describe
"should create a runner if project token provided"
do
context
'when project token is provided'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:empty_project
)
}
before
{
post
ci_api
(
"/runners/register"
),
token:
project
.
runners_token
}
it
{
expect
(
response
.
status
).
to
eq
(
201
)
}
it
{
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
}
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
end
end
it
"should return 403 error if token is invalid"
do
context
'when token is invalid'
do
it
'returns 403 error'
do
post
ci_api
(
"/runners/register"
),
token:
'invalid'
expect
(
response
.
status
).
to
eq
(
403
)
end
end
it
"should return 400 error if no token"
do
context
'when no token provided'
do
it
'returns 400 error'
do
post
ci_api
(
"/runners/register"
)
expect
(
response
.
status
).
to
eq
(
400
)
end
end
%w(name version revision platform architecture)
.
each
do
|
param
|
context
"creates runner with
#{
param
}
saved"
do
...
...
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