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
0e5c1a89
Commit
0e5c1a89
authored
May 01, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec/features/admin/admin_runners_spec.rb + test style improvements
parent
b7b82324
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
14 deletions
+20
-14
spec/controllers/projects/settings/ci_cd_controller_spec.rb
spec/controllers/projects/settings/ci_cd_controller_spec.rb
+13
-7
spec/features/admin/admin_runners_spec.rb
spec/features/admin/admin_runners_spec.rb
+3
-3
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+4
-4
No files found.
spec/controllers/projects/settings/ci_cd_controller_spec.rb
View file @
0e5c1a89
...
@@ -18,17 +18,23 @@ describe Projects::Settings::CiCdController do
...
@@ -18,17 +18,23 @@ describe Projects::Settings::CiCdController do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
end
end
it
'sets assignable project runners'
do
context
'with group runners'
do
group
=
create
(
:group
,
runners:
[
create
(
:ci_runner
)],
parent:
create
(
:group
))
let
(
:group_runner
)
{
create
(
:ci_runner
)
}
let
(
:parent_group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
,
runners:
[
group_runner
],
parent:
parent_group
)
}
let
(
:other_project
)
{
create
(
:project
,
group:
group
)
}
let!
(
:project_runner
)
{
create
(
:ci_runner
,
projects:
[
other_project
])
}
let!
(
:shared_runner
)
{
create
(
:ci_runner
,
:shared
)
}
it
'sets assignable project runners only'
do
group
.
add_master
(
user
)
group
.
add_master
(
user
)
project_runner
=
create
(
:ci_runner
,
projects:
[
create
(
:project
,
group:
group
)])
create
(
:ci_runner
,
:shared
)
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
get
:show
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
assigns
(
:assignable_runners
)).
to
eq
[
project_runner
]
expect
(
assigns
(
:assignable_runners
)).
to
eq
[
project_runner
]
end
end
end
end
end
describe
'#reset_cache'
do
describe
'#reset_cache'
do
before
do
before
do
...
...
spec/features/admin/admin_runners_spec.rb
View file @
0e5c1a89
...
@@ -61,10 +61,10 @@ describe "Admin Runners" do
...
@@ -61,10 +61,10 @@ describe "Admin Runners" do
end
end
context
'group runner'
do
context
'group runner'
do
it
'shows the label and does not show the project count'
do
let
(
:group
)
{
create
(
:group
)
}
group
=
create
:group
let!
(
:runner
)
{
create
(
:ci_runner
,
groups:
[
group
],
runner_type: :group_type
)
}
runner
=
create
:ci_runner
,
groups:
[
group
]
it
'shows the label and does not show the project count'
do
visit
admin_runners_path
visit
admin_runners_path
within
"#runner_
#{
runner
.
id
}
"
do
within
"#runner_
#{
runner
.
id
}
"
do
...
...
spec/models/ci/runner_spec.rb
View file @
0e5c1a89
...
@@ -21,8 +21,9 @@ describe Ci::Runner do
...
@@ -21,8 +21,9 @@ describe Ci::Runner do
end
end
context
'either_projects_or_group'
do
context
'either_projects_or_group'
do
let
(
:group
)
{
create
(
:group
)
}
it
'disallows assigning to a group if already assigned to a group'
do
it
'disallows assigning to a group if already assigned to a group'
do
group
=
create
(
:group
)
runner
=
create
(
:ci_runner
,
groups:
[
group
])
runner
=
create
(
:ci_runner
,
groups:
[
group
])
runner
.
groups
<<
build
(
:group
)
runner
.
groups
<<
build
(
:group
)
...
@@ -42,7 +43,6 @@ describe Ci::Runner do
...
@@ -42,7 +43,6 @@ describe Ci::Runner do
end
end
it
'disallows assigning to a project if already assigned to a group'
do
it
'disallows assigning to a project if already assigned to a group'
do
group
=
create
(
:group
)
runner
=
create
(
:ci_runner
,
groups:
[
group
])
runner
=
create
(
:ci_runner
,
groups:
[
group
])
runner
.
projects
<<
build
(
:project
)
runner
.
projects
<<
build
(
:project
)
...
@@ -189,9 +189,9 @@ describe Ci::Runner do
...
@@ -189,9 +189,9 @@ describe Ci::Runner do
# 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
match_array
[
expect
(
described_class
.
owned_or_shared
(
project
.
id
)).
to
contain_exactly
(
group_runner
,
project_runner
,
shared_runner
group_runner
,
project_runner
,
shared_runner
]
)
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