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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
4a52f44f
Commit
4a52f44f
authored
Feb 22, 2022
by
Pedro Pombeiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix behavior when user is nil
parent
dd6983a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/services/ci/assign_runner_service.rb
app/services/ci/assign_runner_service.rb
+1
-1
spec/services/ci/assign_runner_service_spec.rb
spec/services/ci/assign_runner_service_spec.rb
+3
-3
No files found.
app/services/ci/assign_runner_service.rb
View file @
4a52f44f
...
@@ -12,7 +12,7 @@ module Ci
...
@@ -12,7 +12,7 @@ module Ci
end
end
def
execute
def
execute
return
false
unless
@user
.
nil?
||
@user
.
can?
(
:assign_runner
,
@runner
)
return
false
unless
@user
.
present?
&&
@user
.
can?
(
:assign_runner
,
@runner
)
@runner
.
assign_to
(
@project
,
@user
)
@runner
.
assign_to
(
@project
,
@user
)
end
end
...
...
spec/services/ci/assign_runner_service_spec.rb
View file @
4a52f44f
...
@@ -11,10 +11,10 @@ RSpec.describe ::Ci::AssignRunnerService, '#execute' do
...
@@ -11,10 +11,10 @@ RSpec.describe ::Ci::AssignRunnerService, '#execute' do
context
'without user'
do
context
'without user'
do
let
(
:user
)
{
nil
}
let
(
:user
)
{
nil
}
it
'
calls assign_to on runner and returns value unchanged
'
do
it
'
does not call assign_to on runner and returns false
'
do
expect
(
runner
).
to
receive
(
:assign_to
).
with
(
project
,
nil
).
once
.
and_return
(
'assign_to return value'
)
expect
(
runner
).
not_to
receive
(
:assign_to
)
is_expected
.
to
eq
(
'assign_to return value'
)
is_expected
.
to
eq
(
false
)
end
end
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