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
3a6b9ad8
Commit
3a6b9ad8
authored
May 05, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test license blocking changes.
parent
f00e1d3d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
0 deletions
+105
-0
spec/features/security/project/internal_access_spec.rb
spec/features/security/project/internal_access_spec.rb
+28
-0
spec/features/security/project/private_access_spec.rb
spec/features/security/project/private_access_spec.rb
+28
-0
spec/features/security/project/public_access_spec.rb
spec/features/security/project/public_access_spec.rb
+28
-0
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+21
-0
No files found.
spec/features/security/project/internal_access_spec.rb
View file @
3a6b9ad8
...
...
@@ -224,4 +224,32 @@ describe "Internal Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
context
"when license blocks changes"
do
before
do
allow
(
License
).
to
receive
(
:block_changes?
).
and_return
(
true
)
end
describe
"GET /:project_path/issues/new"
do
subject
{
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_denied_for
master
}
it
{
is_expected
.
to
be_denied_for
reporter
}
it
{
is_expected
.
to
be_denied_for
:admin
}
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
describe
"GET /:project_path/merge_requests/new"
do
subject
{
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_denied_for
master
}
it
{
is_expected
.
to
be_denied_for
reporter
}
it
{
is_expected
.
to
be_denied_for
:admin
}
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
end
end
spec/features/security/project/private_access_spec.rb
View file @
3a6b9ad8
...
...
@@ -202,4 +202,32 @@ describe "Private Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
context
"when license blocks changes"
do
before
do
allow
(
License
).
to
receive
(
:block_changes?
).
and_return
(
true
)
end
describe
"GET /:project_path/issues/new"
do
subject
{
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_denied_for
master
}
it
{
is_expected
.
to
be_denied_for
reporter
}
it
{
is_expected
.
to
be_denied_for
:admin
}
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
describe
"GET /:project_path/merge_requests/new"
do
subject
{
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_denied_for
master
}
it
{
is_expected
.
to
be_denied_for
reporter
}
it
{
is_expected
.
to
be_denied_for
:admin
}
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
end
end
spec/features/security/project/public_access_spec.rb
View file @
3a6b9ad8
...
...
@@ -229,4 +229,32 @@ describe "Public Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
context
"when license blocks changes"
do
before
do
allow
(
License
).
to
receive
(
:block_changes?
).
and_return
(
true
)
end
describe
"GET /:project_path/issues/new"
do
subject
{
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_denied_for
master
}
it
{
is_expected
.
to
be_denied_for
reporter
}
it
{
is_expected
.
to
be_denied_for
:admin
}
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
describe
"GET /:project_path/merge_requests/new"
do
subject
{
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
)
}
it
{
is_expected
.
to
be_denied_for
master
}
it
{
is_expected
.
to
be_denied_for
reporter
}
it
{
is_expected
.
to
be_denied_for
:admin
}
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_denied_for
:user
}
it
{
is_expected
.
to
be_denied_for
:visitor
}
end
end
end
spec/lib/gitlab/git_access_spec.rb
View file @
3a6b9ad8
...
...
@@ -231,6 +231,27 @@ describe Gitlab::GitAccess do
end
end
end
context
"when license blocks changes"
do
before
do
allow
(
License
).
to
receive
(
:block_changes?
).
and_return
(
true
)
end
permissions_matrix
.
keys
.
each
do
|
role
|
describe
"
#{
role
}
access"
do
before
{
protect_feature_branch
}
before
{
project
.
team
<<
[
user
,
role
]
}
permissions_matrix
[
role
].
each
do
|
action
,
allowed
|
context
action
do
subject
{
access
.
push_access_check
(
changes
[
action
])
}
it
{
expect
(
subject
.
allowed?
).
to
be_falsey
}
end
end
end
end
end
end
describe
"pass_git_hooks?"
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