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
0f4df86a
Commit
0f4df86a
authored
Aug 23, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete project_security_spec
re a conversation with @rspeicher, this spec isn't really testing anything.
parent
7d119bab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
112 deletions
+0
-112
spec/models/project_security_spec.rb
spec/models/project_security_spec.rb
+0
-112
No files found.
spec/models/project_security_spec.rb
deleted
100644 → 0
View file @
7d119bab
require
'spec_helper'
describe
Project
,
models:
true
do
describe
'authorization'
do
before
do
@p1
=
create
(
:project
)
@u1
=
create
(
:user
)
@u2
=
create
(
:user
)
@u3
=
create
(
:user
)
@u4
=
@p1
.
owner
@abilities
=
Six
.
new
@abilities
<<
Ability
end
let
(
:guest_actions
)
{
Ability
.
project_guest_rules
}
let
(
:report_actions
)
{
Ability
.
project_report_rules
}
let
(
:dev_actions
)
{
Ability
.
project_dev_rules
}
let
(
:master_actions
)
{
Ability
.
project_master_rules
}
let
(
:owner_actions
)
{
Ability
.
project_owner_rules
}
describe
"Non member rules"
do
it
"denies for non-project users any actions"
do
owner_actions
.
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u1
,
action
,
@p1
)).
to
be_falsey
end
end
end
describe
"Guest Rules"
do
before
do
@p1
.
project_members
.
create
(
project:
@p1
,
user:
@u2
,
access_level:
ProjectMember
::
GUEST
)
end
it
"allows for project user any guest actions"
do
guest_actions
.
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u2
,
action
,
@p1
)).
to
be_truthy
end
end
end
describe
"Report Rules"
do
before
do
@p1
.
project_members
.
create
(
project:
@p1
,
user:
@u2
,
access_level:
ProjectMember
::
REPORTER
)
end
it
"allows for project user any report actions"
do
report_actions
.
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u2
,
action
,
@p1
)).
to
be_truthy
end
end
end
describe
"Developer Rules"
do
before
do
@p1
.
project_members
.
create
(
project:
@p1
,
user:
@u2
,
access_level:
ProjectMember
::
REPORTER
)
@p1
.
project_members
.
create
(
project:
@p1
,
user:
@u3
,
access_level:
ProjectMember
::
DEVELOPER
)
end
it
"denies for developer master-specific actions"
do
[
dev_actions
-
report_actions
].
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u2
,
action
,
@p1
)).
to
be_falsey
end
end
it
"allows for project user any dev actions"
do
dev_actions
.
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u3
,
action
,
@p1
)).
to
be_truthy
end
end
end
describe
"Master Rules"
do
before
do
@p1
.
project_members
.
create
(
project:
@p1
,
user:
@u2
,
access_level:
ProjectMember
::
DEVELOPER
)
@p1
.
project_members
.
create
(
project:
@p1
,
user:
@u3
,
access_level:
ProjectMember
::
MASTER
)
end
it
"denies for developer master-specific actions"
do
[
master_actions
-
dev_actions
].
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u2
,
action
,
@p1
)).
to
be_falsey
end
end
it
"allows for project user any master actions"
do
master_actions
.
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u3
,
action
,
@p1
)).
to
be_truthy
end
end
end
describe
"Owner Rules"
do
before
do
@p1
.
project_members
.
create
(
project:
@p1
,
user:
@u2
,
access_level:
ProjectMember
::
DEVELOPER
)
@p1
.
project_members
.
create
(
project:
@p1
,
user:
@u3
,
access_level:
ProjectMember
::
MASTER
)
end
it
"denies for masters admin-specific actions"
do
[
owner_actions
-
master_actions
].
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u2
,
action
,
@p1
)).
to
be_falsey
end
end
it
"allows for project owner any admin actions"
do
owner_actions
.
each
do
|
action
|
expect
(
@abilities
.
allowed?
(
@u4
,
action
,
@p1
)).
to
be_truthy
end
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