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
Tatuya Kamada
gitlab-ce
Commits
e8cf89fa
Commit
e8cf89fa
authored
Jun 01, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for User#ci_authorized_runners
parent
3fd0b364
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+57
-0
No files found.
spec/models/user_spec.rb
View file @
e8cf89fa
...
@@ -845,6 +845,63 @@ describe User, models: true do
...
@@ -845,6 +845,63 @@ describe User, models: true do
it
{
is_expected
.
to
eq
([
private_project
])
}
it
{
is_expected
.
to
eq
([
private_project
])
}
end
end
describe
'#ci_authorized_runners'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
before
{
project
.
runners
<<
runner
}
context
'without any projects'
do
let
(
:project
)
{
create
(
:project
)
}
it
'does not load'
do
expect
(
user
.
ci_authorized_runners
).
to
eq
([])
end
end
context
'with personal projects runners'
do
let
(
:namespace
)
{
create
(
:namespace
,
owner:
user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
it
'loads'
do
expect
(
user
.
ci_authorized_runners
).
to
eq
([
runner
])
end
end
shared_examples
:member
do
it
'loads when the user is a master'
do
add_user
(
Gitlab
::
Access
::
MASTER
)
expect
(
user
.
ci_authorized_runners
).
to
eq
([
runner
])
end
it
'does not load when the user is a developer'
do
add_user
(
Gitlab
::
Access
::
DEVELOPER
)
expect
(
user
.
ci_authorized_runners
).
to
eq
([])
end
end
context
'with groups projects runners'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
def
add_user
access
group
.
add_user
(
user
,
access
)
end
it_behaves_like
:member
end
context
'with other projects runners'
do
let
(
:project
)
{
create
(
:project
)
}
def
add_user
access
Member
.
add_user
(
project
.
project_members
,
user
,
access
)
end
it_behaves_like
:member
end
end
describe
'#viewable_starred_projects'
do
describe
'#viewable_starred_projects'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:public_project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:public_project
)
{
create
(
:empty_project
,
:public
)
}
...
...
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