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
24f6d46b
Commit
24f6d46b
authored
May 27, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec for User#ci_owned_runners
parent
1a3b6b75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
20 deletions
+17
-20
spec/models/user_spec.rb
spec/models/user_spec.rb
+17
-20
No files found.
spec/models/user_spec.rb
View file @
24f6d46b
...
...
@@ -1907,12 +1907,10 @@ describe User do
describe
'#ci_owned_runners'
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:runner
)
{
create
(
:ci_runner
,
:project
,
projects:
[
project
])
}
context
'without any projects nor groups'
do
let!
(
:project
)
{
create
(
:project
,
runners:
[
runner_1
])
}
let!
(
:group
)
{
create
(
:group
)
}
it
'does not load'
do
expect
(
user
.
ci_owned_runners
).
to
be_empty
end
...
...
@@ -1920,38 +1918,40 @@ describe User do
context
'with personal projects runners'
do
let
(
:namespace
)
{
create
(
:namespace
,
owner:
user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
namespace
,
runners:
[
runner_1
]
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
it
'loads'
do
expect
(
user
.
ci_owned_runners
).
to
contain_exactly
(
runner
_1
)
expect
(
user
.
ci_owned_runners
).
to
contain_exactly
(
runner
)
end
end
context
'with personal group runner'
do
let!
(
:project
)
{
create
(
:project
,
runners:
[
runner_1
])
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:group_runner
)
{
create
(
:ci_runner
,
:group
,
groups:
[
group
])
}
let!
(
:group
)
do
create
(
:group
,
runners:
[
runner_2
]
).
tap
do
|
group
|
create
(
:group
).
tap
do
|
group
|
group
.
add_owner
(
user
)
end
end
it
'loads'
do
expect
(
user
.
ci_owned_runners
).
to
contain_exactly
(
runner_2
)
expect
(
user
.
ci_owned_runners
).
to
contain_exactly
(
group_runner
)
end
end
context
'with personal project and group runner'
do
let
(
:namespace
)
{
create
(
:namespace
,
owner:
user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
namespace
,
runners:
[
runner_1
])
}
let!
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
let!
(
:group_runner
)
{
create
(
:ci_runner
,
:group
,
groups:
[
group
])
}
let!
(
:group
)
do
create
(
:group
,
runners:
[
runner_2
]
).
tap
do
|
group
|
create
(
:group
).
tap
do
|
group
|
group
.
add_owner
(
user
)
end
end
it
'loads'
do
expect
(
user
.
ci_owned_runners
).
to
contain_exactly
(
runner
_1
,
runner_2
)
expect
(
user
.
ci_owned_runners
).
to
contain_exactly
(
runner
,
group_runner
)
end
end
...
...
@@ -1962,7 +1962,7 @@ describe User do
end
it
'loads'
do
expect
(
user
.
ci_owned_runners
).
to
contain_exactly
(
runner
_1
)
expect
(
user
.
ci_owned_runners
).
to
contain_exactly
(
runner
)
end
end
...
...
@@ -1979,7 +1979,7 @@ describe User do
context
'with groups projects runners'
do
let
(
:group
)
{
create
(
:group
)
}
let!
(
:project
)
{
create
(
:project
,
group:
group
,
runners:
[
runner_1
]
)
}
let!
(
:project
)
{
create
(
:project
,
group:
group
)
}
def
add_user
(
access
)
group
.
add_user
(
user
,
access
)
...
...
@@ -1989,11 +1989,8 @@ describe User do
end
context
'with groups runners'
do
let!
(
:group
)
do
create
(
:group
,
runners:
[
runner_1
]).
tap
do
|
group
|
group
.
add_owner
(
user
)
end
end
let!
(
:runner
)
{
create
(
:ci_runner
,
:group
,
groups:
[
group
])
}
let!
(
:group
)
{
create
(
:group
)
}
def
add_user
(
access
)
group
.
add_user
(
user
,
access
)
...
...
@@ -2003,7 +2000,7 @@ describe User do
end
context
'with other projects runners'
do
let!
(
:project
)
{
create
(
:project
,
runners:
[
runner_1
]
)
}
let!
(
:project
)
{
create
(
:project
)
}
def
add_user
(
access
)
project
.
add_role
(
user
,
access
)
...
...
@@ -2016,7 +2013,7 @@ describe User do
let
(
:group
)
{
create
(
:group
)
}
let
(
:another_user
)
{
create
(
:user
)
}
let
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let!
(
:project
)
{
create
(
:project
,
group:
subgroup
,
runners:
[
runner_1
]
)
}
let!
(
:project
)
{
create
(
:project
,
group:
subgroup
)
}
def
add_user
(
access
)
group
.
add_user
(
user
,
access
)
...
...
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