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
Kazuhiko Shiozaki
gitlab-ce
Commits
acfe25ed
Commit
acfe25ed
authored
Feb 17, 2016
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactorize `ci_runner` factory and `let` definitions in runners API spec
parent
e4d2f997
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
22 deletions
+18
-22
spec/factories/ci/runners.rb
spec/factories/ci/runners.rb
+4
-6
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+14
-16
No files found.
spec/factories/ci/runners.rb
View file @
acfe25ed
...
@@ -26,13 +26,11 @@ FactoryGirl.define do
...
@@ -26,13 +26,11 @@ FactoryGirl.define do
end
end
platform
"darwin"
platform
"darwin"
is_shared
false
active
true
factory
:ci_shared_runner
do
trait
:shared
do
is_shared
true
is_shared
true
end
end
factory
:ci_specific_runner
do
is_shared
false
end
end
end
end
end
spec/requests/api/runners_spec.rb
View file @
acfe25ed
require
'spec_helper'
require
'spec_helper'
describe
API
::
API
,
api:
true
do
describe
API
::
Runners
,
api:
true
do
include
ApiHelpers
include
ApiHelpers
let
(
:admin
)
{
create
(
:user
,
:admin
)
}
let
(
:admin
)
{
create
(
:user
,
:admin
)
}
...
@@ -10,20 +10,20 @@ describe API::API, api: true do
...
@@ -10,20 +10,20 @@ describe API::API, api: true do
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:project2
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:project2
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let!
(
:shared_runner
)
{
create
(
:ci_
shared_runner
,
tag_list:
[
'mysql'
,
'ruby'
],
active:
true
)
}
let!
(
:shared_runner
)
{
create
(
:ci_
runner
,
:shared
)
}
let!
(
:unused_specific_runner
)
{
create
(
:ci_
specific_
runner
)
}
let!
(
:unused_specific_runner
)
{
create
(
:ci_runner
)
}
let!
(
:specific_runner
)
do
let!
(
:specific_runner
)
do
runner
=
create
(
:ci_specific_runner
,
tag_list:
[
'mysql'
,
'ruby'
])
create
(
:ci_runner
).
tap
do
|
runner
|
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
runner
end
end
end
let!
(
:two_projects_runner
)
do
let!
(
:two_projects_runner
)
do
runner
=
create
(
:ci_specific_runner
)
create
(
:ci_runner
).
tap
do
|
runner
|
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
create
(
:ci_runner_project
,
runner:
runner
,
project:
project
)
create
(
:ci_runner_project
,
runner:
runner
,
project:
project2
)
create
(
:ci_runner_project
,
runner:
runner
,
project:
project2
)
runner
end
end
end
before
do
before
do
...
@@ -352,14 +352,12 @@ describe API::API, api: true do
...
@@ -352,14 +352,12 @@ describe API::API, api: true do
end
end
describe
'POST /projects/:id/runners'
do
describe
'POST /projects/:id/runners'
do
let
(
:specific_runner2
)
do
context
'authorized user'
do
runner
=
create
(
:ci_specific_runner
)
it
'should enable specific runner'
do
specific_runner2
=
create
(
:ci_runner
).
tap
do
|
runner
|
create
(
:ci_runner_project
,
runner:
runner
,
project:
project2
)
create
(
:ci_runner_project
,
runner:
runner
,
project:
project2
)
runner
end
end
context
'authorized user'
do
it
'should enable specific runner'
do
expect
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user
),
runner_id:
specific_runner2
.
id
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user
),
runner_id:
specific_runner2
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
+
1
)
end
.
to
change
{
project
.
runners
.
count
}.
by
(
+
1
)
...
...
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