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
f194f565
Commit
f194f565
authored
Nov 16, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests
parent
699885c3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
Gemfile.lock
Gemfile.lock
+4
-1
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+9
-9
No files found.
Gemfile.lock
View file @
f194f565
...
...
@@ -840,7 +840,7 @@ DEPENDENCIES
github-linguist (~> 4.7.0)
github-markup (~> 1.3.1)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-license (~> 0.0.
3
)
gitlab-license (~> 0.0.
2
)
gitlab_emoji (~> 0.1)
gitlab_git (~> 7.2.20)
gitlab_meta (= 7.0)
...
...
@@ -942,3 +942,6 @@ DEPENDENCIES
virtus (~> 1.0.1)
webmock (~> 1.21.0)
wikicloth (= 0.8.1)
BUNDLED WITH
1.10.6
spec/lib/gitlab/git_access_spec.rb
View file @
f194f565
...
...
@@ -249,19 +249,19 @@ describe Gitlab::GitAccess do
describe
"git_hook_check"
do
describe
"author email check"
do
it
'returns true'
do
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed
'
,
'570e7b2ab
'
)).
to
be_truthy
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed
97bb5f0054f2b1df789b39ca89b6ff9'
,
'570e7b2abdd848b95f2f578043fc23bd6f6fd24d
'
)).
to
be_truthy
end
it
'returns false'
do
project
.
create_git_hook
project
.
git_hook
.
update
(
commit_message_regex:
"@only.com"
)
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed
'
,
'570e7b2ab
'
)).
not_to
be_allowed
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed
97bb5f0054f2b1df789b39ca89b6ff9'
,
'570e7b2abdd848b95f2f578043fc23bd6f6fd24d
'
)).
not_to
be_allowed
end
it
'returns true for tags'
do
project
.
create_git_hook
project
.
git_hook
.
update
(
commit_message_regex:
"@only.com"
)
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/tags/v1'
,
'6f6d7e7ed
'
,
'570e7b2ab
'
)).
to
be_allowed
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/tags/v1'
,
'6f6d7e7ed
97bb5f0054f2b1df789b39ca89b6ff9'
,
'570e7b2abdd848b95f2f578043fc23bd6f6fd24d
'
)).
to
be_allowed
end
end
...
...
@@ -272,12 +272,12 @@ describe Gitlab::GitAccess do
end
it
'returns false for non-member user'
do
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed
'
,
'570e7b2ab
'
)).
not_to
be_allowed
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed
97bb5f0054f2b1df789b39ca89b6ff9'
,
'570e7b2abdd848b95f2f578043fc23bd6f6fd24d
'
)).
not_to
be_allowed
end
it
'returns true if committer is a gitlab member'
do
create
(
:user
,
email:
'dmitriy.zaporozhets@gmail.com'
)
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed
'
,
'570e7b2ab
'
)).
to
be_allowed
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'6f6d7e7ed
97bb5f0054f2b1df789b39ca89b6ff9'
,
'570e7b2abdd848b95f2f578043fc23bd6f6fd24d
'
)).
to
be_allowed
end
end
...
...
@@ -285,13 +285,13 @@ describe Gitlab::GitAccess do
it
'returns false when filename is prohibited'
do
project
.
create_git_hook
project
.
git_hook
.
update
(
file_name_regex:
"jpg$"
)
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'913c66a37
'
,
'33f3729a4
'
)).
not_to
be_allowed
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'913c66a37
b4a45b9769037c55c2d238bd0942d2e'
,
'33f3729a45c02fc67d00adb1b8bca394b0e761d9
'
)).
not_to
be_allowed
end
it
'returns true if file name is allowed'
do
project
.
create_git_hook
project
.
git_hook
.
update
(
file_name_regex:
"exe$"
)
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'913c66a37
'
,
'33f3729a4
'
)).
to
be_allowed
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'913c66a37
b4a45b9769037c55c2d238bd0942d2e'
,
'33f3729a45c02fc67d00adb1b8bca394b0e761d9
'
)).
to
be_allowed
end
end
...
...
@@ -303,13 +303,13 @@ describe Gitlab::GitAccess do
it
"returns false when size is too large"
do
project
.
create_git_hook
project
.
git_hook
.
update
(
max_file_size:
1
)
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'cfe32cf6
'
,
'913c66a37
'
)).
not_to
be_allowed
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'cfe32cf6
1b73a0d5e9f13e774abde7ff789b1660'
,
'913c66a37b4a45b9769037c55c2d238bd0942d2e
'
)).
not_to
be_allowed
end
it
"returns true when size is allowed"
do
project
.
create_git_hook
project
.
git_hook
.
update
(
max_file_size:
2
)
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'cfe32cf6
'
,
'913c66a37
'
)).
to
be_allowed
expect
(
access
.
git_hook_check
(
user
,
project
,
'refs/heads/master'
,
'cfe32cf6
1b73a0d5e9f13e774abde7ff789b1660'
,
'913c66a37b4a45b9769037c55c2d238bd0942d2e
'
)).
to
be_allowed
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