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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
781d35c1
Commit
781d35c1
authored
Jun 07, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prefer attributes_for_keys so that it ignores nils
Also add a test for setting locked.
parent
894d22f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
lib/ci/api/runners.rb
lib/ci/api/runners.rb
+3
-7
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+4
-2
No files found.
lib/ci/api/runners.rb
View file @
781d35c1
...
...
@@ -28,13 +28,9 @@ module Ci
post
"register"
do
required_attributes!
[
:token
]
attributes
=
{
description:
params
[
:description
],
tag_list:
params
[
:tag_list
],
locked:
!!
params
[
:locked
]
}
unless
params
[
:run_untagged
].
nil?
attributes
[
:run_untagged
]
=
params
[
:run_untagged
]
end
attributes
=
attributes_for_keys
(
[
:description
,
:tag_list
,
:run_untagged
,
:locked
]
)
runner
=
if
runner_registration_token_valid?
...
...
spec/requests/api/runners_spec.rb
View file @
781d35c1
...
...
@@ -187,14 +187,16 @@ describe API::Runners, api: true do
update_runner
(
shared_runner
.
id
,
admin
,
description:
"
#{
description
}
_updated"
,
active:
!
active
,
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
],
run_untagged:
'false'
)
run_untagged:
'false'
,
locked:
'true'
)
shared_runner
.
reload
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
shared_runner
.
description
).
to
eq
(
"
#{
description
}
_updated"
)
expect
(
shared_runner
.
active
).
to
eq
(
!
active
)
expect
(
shared_runner
.
tag_list
).
to
include
(
'ruby2.1'
,
'pgsql'
,
'mysql'
)
expect
(
shared_runner
.
run_untagged?
).
to
be
false
expect
(
shared_runner
.
run_untagged?
).
to
be
(
false
)
expect
(
shared_runner
.
locked?
).
to
be
(
true
)
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