Skip to content

Commit

Permalink
Strip whitespace from queue names
Browse files Browse the repository at this point in the history
  • Loading branch information
mrduncan authored and defunkt committed Feb 3, 2011
1 parent fd03267 commit 7027d71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/resque/worker.rb
Expand Up @@ -73,7 +73,7 @@ def self.exists?(worker_id)
# in alphabetical order. Queues can be dynamically added or
# removed without needing to restart workers using this method.
def initialize(*queues)
@queues = queues
@queues = queues.map { |queue| queue.to_s.strip }
validate_queues
end

Expand Down
6 changes: 6 additions & 0 deletions test/worker_test.rb
Expand Up @@ -57,6 +57,12 @@
assert_equal 2, Resque::Failure.count
end

test "strips whitespace from queue names" do
queues = "critical, high, low".split(',')
worker = Resque::Worker.new(*queues)
assert_equal %w( critical high low ), worker.queues
end

test "can work on multiple queues" do
Resque::Job.create(:high, GoodJob)
Resque::Job.create(:critical, GoodJob)
Expand Down

0 comments on commit 7027d71

Please sign in to comment.