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
Kazuhiko Shiozaki
gitlab-ce
Commits
67fd7432
Commit
67fd7432
authored
Sep 26, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up project access spec
parent
cf237f1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
78 deletions
+92
-78
spec/requests/security/project_access_spec.rb
spec/requests/security/project_access_spec.rb
+92
-78
No files found.
spec/requests/security/project_access_spec.rb
View file @
67fd7432
...
@@ -14,204 +14,218 @@ describe "Application access" do
...
@@ -14,204 +14,218 @@ describe "Application access" do
end
end
describe
"Project"
do
describe
"Project"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:master
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:reporter
)
{
create
(
:user
)
}
before
do
before
do
@project
=
Factory
:project
@u1
=
Factory
:user
@u2
=
Factory
:user
@u3
=
Factory
:user
# full access
# full access
@project
.
users_projects
.
create
(
user:
@u1
,
project_access:
UsersProject
::
MASTER
)
project
.
users_projects
.
create
(
user:
master
,
project_access:
UsersProject
::
MASTER
)
# readonly
# readonly
@project
.
users_projects
.
create
(
user:
@u3
,
project_access:
UsersProject
::
REPORTER
)
project
.
users_projects
.
create
(
user:
reporter
,
project_access:
UsersProject
::
REPORTER
)
end
end
describe
"GET /project_code"
do
describe
"GET /project_code"
do
subject
{
project_path
(
@project
)
}
subject
{
project_path
(
project
)
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
end
describe
"GET /project_code/tree/master"
do
subject
{
project_tree_path
(
project
,
project
.
root_ref
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/
master/tree
"
do
describe
"GET /project_code/
commits/master
"
do
subject
{
project_
tree_path
(
@project
,
@
project
.
root_ref
)
}
subject
{
project_
commits_path
(
project
,
project
.
root_ref
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/commit
s
"
do
describe
"GET /project_code/commit
/:sha
"
do
subject
{
project_commit
s_path
(
@projec
t
)
}
subject
{
project_commit
_path
(
project
,
project
.
commi
t
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/com
mit
"
do
describe
"GET /project_code/com
pare
"
do
subject
{
project_com
mit_path
(
@project
,
@project
.
commit
.
id
)
}
subject
{
project_com
pare_index_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/team"
do
describe
"GET /project_code/team"
do
subject
{
project_team_index_path
(
@
project
)
}
subject
{
project_team_index_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/wall"
do
describe
"GET /project_code/wall"
do
subject
{
wall_project_path
(
@
project
)
}
subject
{
wall_project_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/blob"
do
describe
"GET /project_code/blob"
do
before
do
before
do
commit
=
@
project
.
commit
commit
=
project
.
commit
path
=
commit
.
tree
.
contents
.
select
{
|
i
|
i
.
is_a?
(
Grit
::
Blob
)}.
first
.
name
path
=
commit
.
tree
.
contents
.
select
{
|
i
|
i
.
is_a?
(
Grit
::
Blob
)}.
first
.
name
@blob_path
=
project_blob_path
(
@
project
,
File
.
join
(
commit
.
id
,
path
))
@blob_path
=
project_blob_path
(
project
,
File
.
join
(
commit
.
id
,
path
))
end
end
it
{
@blob_path
.
should
be_allowed_for
@u1
}
it
{
@blob_path
.
should
be_allowed_for
master
}
it
{
@blob_path
.
should
be_allowed_for
@u3
}
it
{
@blob_path
.
should
be_allowed_for
reporter
}
it
{
@blob_path
.
should
be_denied_for
:admin
}
it
{
@blob_path
.
should
be_denied_for
:admin
}
it
{
@blob_path
.
should
be_denied_for
@u2
}
it
{
@blob_path
.
should
be_denied_for
guest
}
it
{
@blob_path
.
should
be_denied_for
:user
}
it
{
@blob_path
.
should
be_denied_for
:user
}
it
{
@blob_path
.
should
be_denied_for
:visitor
}
it
{
@blob_path
.
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/edit"
do
describe
"GET /project_code/edit"
do
subject
{
edit_project_path
(
@
project
)
}
subject
{
edit_project_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_denied_for
@u3
}
it
{
should
be_denied_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/deploy_keys"
do
describe
"GET /project_code/deploy_keys"
do
subject
{
project_deploy_keys_path
(
@
project
)
}
subject
{
project_deploy_keys_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_denied_for
@u3
}
it
{
should
be_denied_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/issues"
do
describe
"GET /project_code/issues"
do
subject
{
project_issues_path
(
@
project
)
}
subject
{
project_issues_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/snippets"
do
describe
"GET /project_code/snippets"
do
subject
{
project_snippets_path
(
@
project
)
}
subject
{
project_snippets_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/merge_requests"
do
describe
"GET /project_code/merge_requests"
do
subject
{
project_merge_requests_path
(
@
project
)
}
subject
{
project_merge_requests_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/repository"
do
describe
"GET /project_code/repository"
do
subject
{
project_repository_path
(
@
project
)
}
subject
{
project_repository_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/repository/branches"
do
describe
"GET /project_code/repository/branches"
do
subject
{
branches_project_repository_path
(
@
project
)
}
subject
{
branches_project_repository_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/repository/tags"
do
describe
"GET /project_code/repository/tags"
do
subject
{
tags_project_repository_path
(
@
project
)
}
subject
{
tags_project_repository_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/hooks"
do
describe
"GET /project_code/hooks"
do
subject
{
project_hooks_path
(
@
project
)
}
subject
{
project_hooks_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /project_code/files"
do
describe
"GET /project_code/files"
do
subject
{
files_project_path
(
@
project
)
}
subject
{
files_project_path
(
project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
@u3
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
:admin
}
it
{
should
be_denied_for
@u2
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
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