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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
0cf0487d
Commit
0cf0487d
authored
Feb 26, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TestHookContext
parent
4e516433
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
app/contexts/test_hook_context.rb
app/contexts/test_hook_context.rb
+1
-2
app/services/git_push_service.rb
app/services/git_push_service.rb
+10
-0
No files found.
app/contexts/test_hook_context.rb
View file @
0cf0487d
class
TestHookContext
<
BaseContext
def
execute
hook
=
project
.
hooks
.
find
(
params
[
:id
])
commits
=
project
.
repository
.
commits
(
project
.
default_branch
,
nil
,
3
)
data
=
project
.
post_receive_data
(
commits
.
last
.
id
,
commits
.
first
.
id
,
"refs/heads/
#{
project
.
default_branch
}
"
,
current_user
)
data
=
GitPushService
.
new
.
sample_data
(
project
,
current_user
)
hook
.
execute
(
data
)
end
end
app/services/git_push_service.rb
View file @
0cf0487d
...
...
@@ -31,6 +31,16 @@ class GitPushService
create_push_event
end
# This method provide a sample data
# generated with post_receive_data method
# for given project
#
def
sample_data
(
project
,
user
)
@project
,
@user
=
project
,
user
commits
=
project
.
repository
.
commits
(
project
.
default_branch
,
nil
,
3
)
post_receive_data
(
commits
.
last
.
id
,
commits
.
first
.
id
,
"refs/heads/
#{
project
.
default_branch
}
"
)
end
protected
def
create_push_event
...
...
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