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
b2e48f27
Commit
b2e48f27
authored
Nov 04, 2014
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some specs for gitlab_access class
parent
c9470f5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+44
-0
No files found.
spec/lib/gitlab/git_access_spec.rb
View file @
b2e48f27
...
...
@@ -124,4 +124,48 @@ describe Gitlab::GitAccess do
end
end
end
describe
"pass_git_hooks?"
do
describe
"author email check"
do
it
'returns true'
do
access
.
pass_git_hooks?
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed'
,
'570e7b2ab'
).
should
be_true
end
it
'returns false'
do
project
.
create_git_hook
project
.
git_hook
.
update
(
commit_message_regex:
"@only.com"
)
access
.
pass_git_hooks?
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed'
,
'570e7b2ab'
).
should
be_false
end
end
describe
"member_check"
do
before
do
project
.
create_git_hook
project
.
git_hook
.
update
(
member_check:
true
)
end
it
'returns false for non-member user'
do
access
.
pass_git_hooks?
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed'
,
'570e7b2ab'
).
should
be_false
end
it
'returns true if committer is a gitlab member'
do
create
(
:user
,
email:
'dmitriy.zaporozhets@gmail.com'
)
access
.
pass_git_hooks?
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed'
,
'570e7b2ab'
).
should
be_true
end
end
describe
"file names check"
do
it
'returns false when filename is prohibited'
do
project
.
create_git_hook
project
.
git_hook
.
update
(
file_name_regex:
"jpg$"
)
access
.
pass_git_hooks?
(
user
,
project
,
'refs/heads/master'
,
'913c66a37'
,
'33f3729a4'
).
should
be_false
end
it
'returns true if file name is allowed'
do
project
.
create_git_hook
project
.
git_hook
.
update
(
file_name_regex:
"exe$"
)
access
.
pass_git_hooks?
(
user
,
project
,
'refs/heads/master'
,
'913c66a37'
,
'33f3729a4'
).
should
be_true
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