Permalink
Browse files

Support for deleting queues

  • Loading branch information...
tarcieri committed Dec 21, 2012
1 parent 45206a3 commit c7473210d0aa1ed5954b738f7fb6c7892bde3324
@@ -2,4 +2,9 @@ class QueuesController < ApplicationController
def show
set_subtabs view_context.queue_names
end
+
+ def destroy
+ Resque.remove_queue(params[:id])
+ redirect_to queues_path
+ end
end
@@ -1,6 +1,6 @@
<h1>Pending jobs on <span class='hl'><%= params[:id] %></span></h1>
- <%= form_tag("/queue/#{params[:id]}", :method => :delete, :class => 'remove-queue') do %>
+ <%= form_tag(queue_path(params[:id]), :method => :delete, :class => 'remove-queue') do %>
<%= submit_tag "Remove Queue", :confirm => "Are you absolutely sure? This cannot be undone.", :class => 'btn btn-danger' %>
<% end %>
@@ -1,7 +1,15 @@
require 'test_helper'
class QueuesControllerTest < ActionController::TestCase
- # test "the truth" do
- # assert true
- # end
+ let(:queue_name) { 'example_queue' }
+
+ it "deletes queues" do
+ Resque.push(queue_name, :class => 'ExampleJob')
+ Resque.queues.include?(queue_name).must_equal true
+
+ delete :destroy, :id => queue_name
+ assert_redirected_to queues_path
+
+ Resque.queues.include?(queue_name).wont_equal true
+ end
end

0 comments on commit c747321

Please sign in to comment.