summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-01-15 14:38:50 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-01-15 14:38:50 +0200
commit8bfc62fb8b02bde7da97958deb8aeda63581bfce (patch)
tree1ccb80a7780a4d7b888070c690276bf6271d8989 /app/controllers/projects
parent37ef33cba18f947699fc3f285397be34861ab51e (diff)
downloadgitlab-ce-8bfc62fb8b02bde7da97958deb8aeda63581bfce.tar.gz
Convert TestHookContext into TestHookService. Added tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/hooks_controller.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb
index 314d87df034..a863b318324 100644
--- a/app/controllers/projects/hooks_controller.rb
+++ b/app/controllers/projects/hooks_controller.rb
@@ -24,15 +24,20 @@ class Projects::HooksController < Projects::ApplicationController
end
def test
- TestHookContext.new(project, current_user, params).execute
+ TestHookService.new.execute(hook, current_user)
redirect_to :back
end
def destroy
- @hook = @project.hooks.find(params[:id])
- @hook.destroy
+ hook.destroy
redirect_to project_hooks_path(@project)
end
+
+ private
+
+ def hook
+ @hook ||= @project.hooks.find(params[:id])
+ end
end