spec/queues_spec.rb in resque-dynamic-queues-0.7.1 vs spec/queues_spec.rb in resque-dynamic-queues-0.8.0
- old
+ new
@@ -142,9 +142,31 @@
Resque.set_dynamic_queue("mykey", ["foo", "bar"])
worker = Resque::Worker.new("@mykey")
worker.queues.should == ["bar", "foo"]
end
+ it "can blacklist dynamic queues" do
+ Resque.watch_queue("high_x")
+ Resque.watch_queue("foo")
+ Resque.watch_queue("high_y")
+ Resque.watch_queue("superhigh_z")
+
+ Resque.set_dynamic_queue("mykey", ["foo"])
+ worker = Resque::Worker.new("*", "!@mykey")
+ worker.queues.should == ["high_x", "high_y", "superhigh_z"]
+ end
+
+ it "can blacklist dynamic queues with negation" do
+ Resque.watch_queue("high_x")
+ Resque.watch_queue("foo")
+ Resque.watch_queue("high_y")
+ Resque.watch_queue("superhigh_z")
+
+ Resque.set_dynamic_queue("mykey", ["!foo", "high_x"])
+ worker = Resque::Worker.new("!@mykey")
+ worker.queues.should == ["foo"]
+ end
+
it "will not bloat the workers queue" do
Resque.watch_queue("high_x")
worker = Resque::Worker.new("@mykey")
worker.send(:instance_eval, "@queues").should == ['@mykey']