diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-26 23:04:14 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-26 23:04:14 +0200 |
commit | 0cf0487d65a482b1e9d8dfe69899e333216a387c (patch) | |
tree | 05b00ddc7892a0387cfb7e68f90ff65a0765d172 | |
parent | 4e5164338a77894c68816bc1e7eec018aea8301c (diff) | |
download | gitlab-ce-0cf0487d65a482b1e9d8dfe69899e333216a387c.tar.gz |
Fix TestHookContext
-rw-r--r-- | app/contexts/test_hook_context.rb | 3 | ||||
-rw-r--r-- | app/services/git_push_service.rb | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/app/contexts/test_hook_context.rb b/app/contexts/test_hook_context.rb index d2d82a52cf5..63eda6c7d06 100644 --- a/app/contexts/test_hook_context.rb +++ b/app/contexts/test_hook_context.rb @@ -1,8 +1,7 @@ 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 diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index 55cf31cd8f8..40d57c67573 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -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 |