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
1f7f29b7
Commit
1f7f29b7
authored
May 03, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Style changes to spec/models/ci/runner_spec.rb
parent
80bcb376
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
35 deletions
+35
-35
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+35
-35
No files found.
spec/models/ci/runner_spec.rb
View file @
1f7f29b7
...
...
@@ -107,16 +107,17 @@ describe Ci::Runner do
end
describe
'.shared'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
)
}
it
'returns the shared group runner'
do
group
=
create
:group
runner
=
create
:ci_runner
,
:shared
,
groups:
[
group
]
runner
=
create
(
:ci_runner
,
:shared
,
groups:
[
group
])
expect
(
described_class
.
shared
).
to
eq
[
runner
]
end
it
'returns the shared project runner'
do
project
=
create
:project
runner
=
create
:ci_runner
,
:shared
,
projects:
[
project
]
runner
=
create
(
:ci_runner
,
:shared
,
projects:
[
project
])
expect
(
described_class
.
shared
).
to
eq
[
runner
]
end
...
...
@@ -125,12 +126,12 @@ describe Ci::Runner do
describe
'.belonging_to_project'
do
it
'returns the specific project runner'
do
# own
specific_project
=
create
:project
specific_runner
=
create
:ci_runner
,
:specific
,
projects:
[
specific_project
]
specific_project
=
create
(
:project
)
specific_runner
=
create
(
:ci_runner
,
:specific
,
projects:
[
specific_project
])
# other
other_project
=
create
:project
create
:ci_runner
,
:specific
,
projects:
[
other_project
]
other_project
=
create
(
:project
)
create
(
:ci_runner
,
:specific
,
projects:
[
other_project
])
expect
(
described_class
.
belonging_to_project
(
specific_project
.
id
)).
to
eq
[
specific_runner
]
end
...
...
@@ -139,55 +140,54 @@ describe Ci::Runner do
describe
'.belonging_to_any_project'
do
it
'returns the specific project runner'
do
# project
project_project
=
create
:project
project_runner
=
create
:ci_runner
,
:specific
,
projects:
[
project_project
]
project_project
=
create
(
:project
)
project_runner
=
create
(
:ci_runner
,
:specific
,
projects:
[
project_project
])
# group
group
=
create
:group
create
:project
,
group:
group
create
:ci_runner
,
:specific
,
groups:
[
group
]
group
=
create
(
:group
)
create
(
:project
,
group:
group
)
create
(
:ci_runner
,
:specific
,
groups:
[
group
])
expect
(
described_class
.
belonging_to_any_project
).
to
eq
[
project_runner
]
end
end
describe
'.belonging_to_parent_group_of_project'
do
it
'returns the specific group runner'
do
# own
specific_group
=
create
:group
specific_project
=
create
:project
,
group:
specific_group
specific_runner
=
create
:ci_runner
,
:specific
,
groups:
[
specific_group
]
# other
other_group
=
create
:group
create
:project
,
group:
other_group
create
:ci_runner
,
:specific
,
groups:
[
other_group
]
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:runner
)
{
create
(
:ci_runner
,
:specific
,
groups:
[
group
])
}
let!
(
:unrelated_group
)
{
create
(
:group
)
}
let!
(
:unrelated_project
)
{
create
(
:project
,
group:
unrelated_group
)
}
let!
(
:unrelated_runner
)
{
create
(
:ci_runner
,
:specific
,
groups:
[
unrelated_group
])
}
expect
(
described_class
.
belonging_to_parent_group_of_project
(
specific_project
.
id
)).
to
eq
[
specific_runner
]
it
'returns the specific group runner'
do
expect
(
described_class
.
belonging_to_parent_group_of_project
(
project
.
id
)).
to
contain_exactly
(
runner
)
end
it
'returns the group runner from a parent group
'
,
:nested_groups
do
parent_group
=
create
:group
group
=
create
:group
,
parent:
parent_group
project
=
create
:project
,
group:
group
runner
=
create
:ci_runner
,
:specific
,
groups:
[
parent_group
]
context
'with a parent group with a runner
'
,
:nested_groups
do
let
(
:runner
)
{
create
(
:ci_runner
,
:specific
,
groups:
[
parent_group
])
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:group
)
{
create
(
:group
,
parent:
parent_group
)
}
let
(
:parent_group
)
{
create
(
:group
)
}
expect
(
described_class
.
belonging_to_parent_group_of_project
(
project
.
id
)).
to
eq
[
runner
]
it
'returns the group runner from the parent group'
do
expect
(
described_class
.
belonging_to_parent_group_of_project
(
project
.
id
)).
to
contain_exactly
(
runner
)
end
end
end
describe
'.owned_or_shared'
do
it
'returns a globally shared, a project specific and a group specific runner'
do
# group specific
group
=
create
:group
project
=
create
:project
,
group:
group
group_runner
=
create
:ci_runner
,
:specific
,
groups:
[
group
]
group
=
create
(
:group
)
project
=
create
(
:project
,
group:
group
)
group_runner
=
create
(
:ci_runner
,
:specific
,
groups:
[
group
])
# project specific
project_runner
=
create
:ci_runner
,
:specific
,
projects:
[
project
]
project_runner
=
create
(
:ci_runner
,
:specific
,
projects:
[
project
])
# globally shared
shared_runner
=
create
:ci_runner
,
:shared
shared_runner
=
create
(
:ci_runner
,
:shared
)
expect
(
described_class
.
owned_or_shared
(
project
.
id
)).
to
contain_exactly
(
group_runner
,
project_runner
,
shared_runner
...
...
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