Commit 0cf0487d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix TestHookContext

parent 4e516433
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
......@@ -31,6 +31,16 @@ def execute(project, user, oldrev, newrev, ref)
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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment