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
Show 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'
require
'spec_helper'
describe
Gitlab
::
Git
::
HooksService
do
describe
Gitlab
::
Git
::
HooksService
,
seed_helper:
true
do
include
RepoHelpers
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
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:service
)
{
described_class
.
new
}
let
(
:service
)
{
described_class
.
new
}
before
do
before
do
@blankrev
=
Gitlab
::
Git
::
BLANK_SHA
@blankrev
=
Gitlab
::
Git
::
BLANK_SHA
@oldrev
=
sample_commit
.
parent_id
@oldrev
=
SeedRepo
::
Commit
::
PARENT_ID
@newrev
=
sample_commit
.
id
@newrev
=
SeedRepo
::
Commit
::
ID
@ref
=
'refs/heads/feature'
@ref
=
'refs/heads/feature'
end
end
...
@@ -20,7 +18,7 @@ describe Gitlab::Git::HooksService do
...
@@ -20,7 +18,7 @@ describe Gitlab::Git::HooksService do
hook
=
double
(
trigger:
[
true
,
nil
])
hook
=
double
(
trigger:
[
true
,
nil
])
expect
(
Gitlab
::
Git
::
Hook
).
to
receive
(
:new
).
exactly
(
3
).
times
.
and_return
(
hook
)
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
end
end
...
@@ -30,7 +28,7 @@ describe Gitlab::Git::HooksService do
...
@@ -30,7 +28,7 @@ describe Gitlab::Git::HooksService do
expect
(
service
).
not_to
receive
(
:run_hook
).
with
(
'post-receive'
)
expect
(
service
).
not_to
receive
(
:run_hook
).
with
(
'post-receive'
)
expect
do
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
.
to
raise_error
(
Gitlab
::
Git
::
HooksService
::
PreReceiveError
)
end
end
end
end
...
@@ -42,7 +40,7 @@ describe Gitlab::Git::HooksService do
...
@@ -42,7 +40,7 @@ describe Gitlab::Git::HooksService do
expect
(
service
).
not_to
receive
(
:run_hook
).
with
(
'post-receive'
)
expect
(
service
).
not_to
receive
(
:run_hook
).
with
(
'post-receive'
)
expect
do
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
.
to
raise_error
(
Gitlab
::
Git
::
HooksService
::
PreReceiveError
)
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