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
Boxiang Sun
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
...
@@ -107,16 +107,17 @@ describe Ci::Runner do
end
end
describe
'.shared'
do
describe
'.shared'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
)
}
it
'returns the shared group runner'
do
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
]
expect
(
described_class
.
shared
).
to
eq
[
runner
]
end
end
it
'returns the shared project runner'
do
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
]
expect
(
described_class
.
shared
).
to
eq
[
runner
]
end
end
...
@@ -125,12 +126,12 @@ describe Ci::Runner do
...
@@ -125,12 +126,12 @@ describe Ci::Runner do
describe
'.belonging_to_project'
do
describe
'.belonging_to_project'
do
it
'returns the specific project runner'
do
it
'returns the specific project runner'
do
# own
# own
specific_project
=
create
:project
specific_project
=
create
(
:project
)
specific_runner
=
create
:ci_runner
,
:specific
,
projects:
[
specific_project
]
specific_runner
=
create
(
:ci_runner
,
:specific
,
projects:
[
specific_project
])
# other
# other
other_project
=
create
:project
other_project
=
create
(
:project
)
create
:ci_runner
,
:specific
,
projects:
[
other_project
]
create
(
:ci_runner
,
:specific
,
projects:
[
other_project
])
expect
(
described_class
.
belonging_to_project
(
specific_project
.
id
)).
to
eq
[
specific_runner
]
expect
(
described_class
.
belonging_to_project
(
specific_project
.
id
)).
to
eq
[
specific_runner
]
end
end
...
@@ -139,55 +140,54 @@ describe Ci::Runner do
...
@@ -139,55 +140,54 @@ describe Ci::Runner do
describe
'.belonging_to_any_project'
do
describe
'.belonging_to_any_project'
do
it
'returns the specific project runner'
do
it
'returns the specific project runner'
do
# project
# project
project_project
=
create
:project
project_project
=
create
(
:project
)
project_runner
=
create
:ci_runner
,
:specific
,
projects:
[
project_project
]
project_runner
=
create
(
:ci_runner
,
:specific
,
projects:
[
project_project
])
# group
# group
group
=
create
:group
group
=
create
(
:group
)
create
:project
,
group:
group
create
(
:project
,
group:
group
)
create
:ci_runner
,
:specific
,
groups:
[
group
]
create
(
:ci_runner
,
:specific
,
groups:
[
group
])
expect
(
described_class
.
belonging_to_any_project
).
to
eq
[
project_runner
]
expect
(
described_class
.
belonging_to_any_project
).
to
eq
[
project_runner
]
end
end
end
end
describe
'.belonging_to_parent_group_of_project'
do
describe
'.belonging_to_parent_group_of_project'
do
it
'returns the specific group runner'
do
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
# own
let
(
:group
)
{
create
(
:group
)
}
specific_group
=
create
:group
let
(
:runner
)
{
create
(
:ci_runner
,
:specific
,
groups:
[
group
])
}
specific_project
=
create
:project
,
group:
specific_group
let!
(
:unrelated_group
)
{
create
(
:group
)
}
specific_runner
=
create
:ci_runner
,
:specific
,
groups:
[
specific_group
]
let!
(
:unrelated_project
)
{
create
(
:project
,
group:
unrelated_group
)
}
let!
(
:unrelated_runner
)
{
create
(
:ci_runner
,
:specific
,
groups:
[
unrelated_group
])
}
# other
other_group
=
create
:group
create
:project
,
group:
other_group
create
:ci_runner
,
:specific
,
groups:
[
other_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
end
it
'returns the group runner from a parent group
'
,
:nested_groups
do
context
'with a parent group with a runner
'
,
:nested_groups
do
parent_group
=
create
:group
let
(
:runner
)
{
create
(
:ci_runner
,
:specific
,
groups:
[
parent_group
])
}
group
=
create
:group
,
parent:
parent_group
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
project
=
create
:project
,
group:
group
let
(
:group
)
{
create
(
:group
,
parent:
parent_group
)
}
runner
=
create
:ci_runner
,
:specific
,
groups:
[
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
end
end
describe
'.owned_or_shared'
do
describe
'.owned_or_shared'
do
it
'returns a globally shared, a project specific and a group specific runner'
do
it
'returns a globally shared, a project specific and a group specific runner'
do
# group specific
# group specific
group
=
create
:group
group
=
create
(
:group
)
project
=
create
:project
,
group:
group
project
=
create
(
:project
,
group:
group
)
group_runner
=
create
:ci_runner
,
:specific
,
groups:
[
group
]
group_runner
=
create
(
:ci_runner
,
:specific
,
groups:
[
group
])
# project specific
# project specific
project_runner
=
create
:ci_runner
,
:specific
,
projects:
[
project
]
project_runner
=
create
(
:ci_runner
,
:specific
,
projects:
[
project
])
# globally shared
# 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
(
expect
(
described_class
.
owned_or_shared
(
project
.
id
)).
to
contain_exactly
(
group_runner
,
project_runner
,
shared_runner
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