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
4b0e31ba
Commit
4b0e31ba
authored
Aug 28, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend can_pick?
parent
6fbb3ce6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
app/models/ci/runner.rb
app/models/ci/runner.rb
+2
-0
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+24
-0
No files found.
app/models/ci/runner.rb
View file @
4b0e31ba
...
@@ -111,6 +111,8 @@ module Ci
...
@@ -111,6 +111,8 @@ module Ci
end
end
def
can_pick?
(
build
)
def
can_pick?
(
build
)
return
false
if
self
.
protected_?
&&
!
build
.
protected?
assignable_for?
(
build
.
project
)
&&
accepting_tags?
(
build
)
assignable_for?
(
build
.
project
)
&&
accepting_tags?
(
build
)
end
end
...
...
spec/models/ci/runner_spec.rb
View file @
4b0e31ba
...
@@ -95,6 +95,8 @@ describe Ci::Runner do
...
@@ -95,6 +95,8 @@ describe Ci::Runner do
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
subject
{
runner
.
can_pick?
(
build
)
}
before
do
before
do
build
.
project
.
runners
<<
runner
build
.
project
.
runners
<<
runner
end
end
...
@@ -222,6 +224,28 @@ describe Ci::Runner do
...
@@ -222,6 +224,28 @@ describe Ci::Runner do
end
end
end
end
end
end
context
'when runner is protected'
do
before
do
runner
.
protected_!
end
context
'when build is protected'
do
before
do
build
.
protected
=
true
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when build is unprotected'
do
before
do
build
.
protected
=
false
end
it
{
is_expected
.
to
be_falsey
}
end
end
end
end
describe
'#status'
do
describe
'#status'
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