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
c47b947a
Commit
c47b947a
authored
Aug 22, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move GitHooksService tests
parent
dc7c6bed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
spec/lib/gitlab/git/hooks_service_spec.rb
spec/lib/gitlab/git/hooks_service_spec.rb
+8
-10
No files found.
spec/
services/git_
hooks_service_spec.rb
→
spec/
lib/gitlab/git/
hooks_service_spec.rb
View file @
c47b947a
require
'spec_helper'
describe
Gitlab
::
Git
::
HooksService
do
include
RepoHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
describe
Gitlab
::
Git
::
HooksService
,
seed_helper:
true
do
let
(
:committer
)
{
Gitlab
::
Git
::
Committer
.
new
(
'Jane Doe'
,
'janedoe@example.com'
,
'user-456'
)
}
let
(
:repository
)
{
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_REPO_PATH
,
'project-123'
)
}
let
(
:service
)
{
described_class
.
new
}
before
do
@blankrev
=
Gitlab
::
Git
::
BLANK_SHA
@oldrev
=
sample_commit
.
parent_id
@newrev
=
sample_commit
.
id
@oldrev
=
SeedRepo
::
Commit
::
PARENT_ID
@newrev
=
SeedRepo
::
Commit
::
ID
@ref
=
'refs/heads/feature'
end
...
...
@@ -20,7 +18,7 @@ describe Gitlab::Git::HooksService do
hook
=
double
(
trigger:
[
true
,
nil
])
expect
(
Gitlab
::
Git
::
Hook
).
to
receive
(
:new
).
exactly
(
3
).
times
.
and_return
(
hook
)
service
.
execute
(
user
,
project
,
@blankrev
,
@newrev
,
@ref
)
{
}
service
.
execute
(
committer
,
repository
,
@blankrev
,
@newrev
,
@ref
)
{
}
end
end
...
...
@@ -30,7 +28,7 @@ describe Gitlab::Git::HooksService do
expect
(
service
).
not_to
receive
(
:run_hook
).
with
(
'post-receive'
)
expect
do
service
.
execute
(
user
,
project
,
@blankrev
,
@newrev
,
@ref
)
service
.
execute
(
committer
,
repository
,
@blankrev
,
@newrev
,
@ref
)
end
.
to
raise_error
(
Gitlab
::
Git
::
HooksService
::
PreReceiveError
)
end
end
...
...
@@ -42,7 +40,7 @@ describe Gitlab::Git::HooksService do
expect
(
service
).
not_to
receive
(
:run_hook
).
with
(
'post-receive'
)
expect
do
service
.
execute
(
user
,
project
,
@blankrev
,
@newrev
,
@ref
)
service
.
execute
(
committer
,
repository
,
@blankrev
,
@newrev
,
@ref
)
end
.
to
raise_error
(
Gitlab
::
Git
::
HooksService
::
PreReceiveError
)
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