Fix TestHookContext
This commit is contained in:
parent
4e5164338a
commit
0cf0487d65
2 changed files with 11 additions and 2 deletions
|
@ -1,8 +1,7 @@
|
||||||
class TestHookContext < BaseContext
|
class TestHookContext < BaseContext
|
||||||
def execute
|
def execute
|
||||||
hook = project.hooks.find(params[:id])
|
hook = project.hooks.find(params[:id])
|
||||||
commits = project.repository.commits(project.default_branch, nil, 3)
|
data = GitPushService.new.sample_data(project, current_user)
|
||||||
data = project.post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", current_user)
|
|
||||||
hook.execute(data)
|
hook.execute(data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,6 +31,16 @@ class GitPushService
|
||||||
create_push_event
|
create_push_event
|
||||||
end
|
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
|
protected
|
||||||
|
|
||||||
def create_push_event
|
def create_push_event
|
||||||
|
|
Loading…
Add table
Reference in a new issue