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
Jérome Perrin
gitlab-ce
Commits
be95e03a
Commit
be95e03a
authored
Aug 19, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for Ability.project_abilities
parent
41d89533
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
spec/models/ability_spec.rb
spec/models/ability_spec.rb
+63
-0
No files found.
spec/models/ability_spec.rb
View file @
be95e03a
...
@@ -171,6 +171,69 @@ describe Ability, lib: true do
...
@@ -171,6 +171,69 @@ describe Ability, lib: true do
end
end
end
end
shared_examples_for
".project_abilities"
do
|
enable_request_store
|
before
do
RequestStore
.
begin!
if
enable_request_store
end
after
do
if
enable_request_store
RequestStore
.
end!
RequestStore
.
clear!
end
end
describe
'.project_abilities'
do
let!
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let!
(
:user
)
{
create
(
:user
)
}
it
'returns permissions for admin user'
do
admin
=
create
(
:admin
)
results
=
described_class
.
project_abilities
(
admin
,
project
)
expect
(
results
.
count
).
to
eq
(
90
)
end
it
'returns permissions for an owner'
do
results
=
described_class
.
project_abilities
(
project
.
owner
,
project
)
expect
(
results
.
count
).
to
eq
(
90
)
end
it
'returns permissions for a guest'
do
project
.
team
<<
[
user
,
:guest
]
results
=
described_class
.
project_abilities
(
user
,
project
)
expect
(
results
.
count
).
to
eq
(
22
)
end
it
'returns permissions for a developer'
do
project
.
team
<<
[
user
,
:developer
]
results
=
described_class
.
project_abilities
(
user
,
project
)
expect
(
results
.
count
).
to
eq
(
22
)
end
it
'returns permissions for a master'
do
project
.
team
<<
[
user
,
:master
]
results
=
described_class
.
project_abilities
(
user
,
project
)
expect
(
results
.
count
).
to
eq
(
22
)
end
end
end
describe
'.project_abilities with RequestStore'
do
it_behaves_like
".project_abilities"
,
true
end
describe
'.project_abilities without RequestStore'
do
it_behaves_like
".project_abilities"
,
false
end
describe
'.issues_readable_by_user'
do
describe
'.issues_readable_by_user'
do
context
'with an admin user'
do
context
'with an admin user'
do
it
'returns all given issues'
do
it
'returns all given issues'
do
...
...
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