[6.6.0] 500 when trying to add a web hook with no url
Created by: cartierjf
Steps to reproduce:
- Go to a project Web Hooks section
- Click on "Add Web Hook" without filling the URL information
- There will be a 500 error
Expected behavior: An error saying that the URL cannot be empty should be displayed. Note that this was also happening in 6.5.1
Log:
Started POST "/***/***/hooks" for 127.0.0.1 at 2014-02-22 11:51:40 -0500
Processing by Projects::HooksController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"****", "hook"=>{"url"=>"", "push_events"=>"1", "issues_events"=>"0", "merge_requests_events"=>"0"}, "project_id"=>"***/***"}
Rendered projects/hooks/index.html.haml within layouts/project_settings (10.7ms)
Completed 500 Internal Server Error in 90ms
ActionView::Template::Error (No route matches {:action=>"test", :controller=>"projects/hooks", :project_id=>#<Project id: 18, name: "***", path: "***", description: "***", created_at: "2013-11-09 00:03:29", updated_at: "2013-12-18 13:33:58", creator_id: 1, issues_enabled: true, wall_enabled: false, merge_requests_enabled: true, wiki_enabled: false, namespace_id: 15, issues_tracker: "gitlab", issues_tracker_id: nil, snippets_enabled: false, last_activity_at: "2014-02-21 22:57:34", imported: false, import_url: "", visibility_level: 0, archived: false>, :id=>#<ProjectHook id: nil, url: "", project_id: 18, created_at: nil, updated_at: nil, type: "ProjectHook", service_id: nil, push_events: true, issues_events: false, merge_requests_events: false>, :format=>nil} missing required keys: [:id]):
51: - @hooks.each do |hook|
52: %li
53: .pull-right
54: = link_to 'Test Hook', test_project_hook_path(@project, hook), class: "btn btn-small grouped"
55: = link_to 'Remove', project_hook_path(@project, hook), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove btn-small grouped"
56: .clearfix
57: %span.monospace= hook.url
app/views/projects/hooks/index.html.haml:54:in `block in _app_views_projects_hooks_index_html_haml__269039527031362426_30432480'
app/views/projects/hooks/index.html.haml:51:in `_app_views_projects_hooks_index_html_haml__269039527031362426_30432480'
app/controllers/projects/hooks_controller.rb:22:in `create'
app/controllers/application_controller.rb:57:in `set_current_user_for_thread'