From 0ff8975939846a3d013421d1f46baf3cbb77dec2 Mon Sep 17 00:00:00 2001
From: Kamil Trzcinski <ayufan@ayufan.eu>
Date: Wed, 14 Oct 2015 19:57:20 +0200
Subject: [PATCH] Fix cancel_all specs

---
 app/views/projects/builds/index.html.haml | 2 +-
 config/routes.rb                          | 2 +-
 spec/features/builds_spec.rb              | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/views/projects/builds/index.html.haml b/app/views/projects/builds/index.html.haml
index 56bb7b11177..b04784025f1 100644
--- a/app/views/projects/builds/index.html.haml
+++ b/app/views/projects/builds/index.html.haml
@@ -6,7 +6,7 @@
     - if @ci_project && current_user && can?(current_user, :manage_builds, @project)
       .pull-left.hidden-xs
         - if @all_builds.running_or_pending.any?
-          = link_to 'Cancel all', cancel_all_namespace_project_builds_path(@project.namespace, @project), data: { confirm: 'Are you sure?' }, method: :post, class: 'btn btn-danger'
+          = link_to 'Cancel all', cancel_all_namespace_project_builds_path(@project.namespace, @project), data: { confirm: 'Are you sure?' }, class: 'btn btn-danger'
 
   %ul.center-top-menu
     %li{class: ('active' if @scope.nil?)}
diff --git a/config/routes.rb b/config/routes.rb
index 3253d950f27..06abc2820a5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -587,7 +587,7 @@ Gitlab::Application.routes.draw do
 
         resources :builds, only: [:index, :show] do
           collection do
-            post :cancel_all
+            get :cancel_all
           end
 
           member do
diff --git a/spec/features/builds_spec.rb b/spec/features/builds_spec.rb
index a339a151112..941e45408a7 100644
--- a/spec/features/builds_spec.rb
+++ b/spec/features/builds_spec.rb
@@ -47,10 +47,10 @@ describe "Builds" do
     end
   end
 
-  describe "POST /:project/builds/:id/cancel_all" do
+  describe "GET /:project/builds/:id/cancel_all" do
     before do
       @build.run!
-      visit cancel_namespace_project_build_path(@gl_project.namespace, @gl_project, @build)
+      visit cancel_all_namespace_project_builds_path(@gl_project.namespace, @gl_project)
     end
 
     it { expect(page).to have_content 'All' }
-- 
GitLab