Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow specification of a custom queue class

  • Loading branch information...
commit 664f96ace0b371685fa3d919cf9ac33705a5013e 1 parent 64c9cac
@alindeman alindeman authored
View
4 lib/extras/queued_log_message_handler.rb
@@ -9,10 +9,10 @@ class QueuedLogMessageHandler < BaseHandler
# later.
attr_accessor :message_limit
- def initialize(name)
+ def initialize(name, opts = {})
super(name)
- @queue = Queue.new
+ @queue = opts[:queue] || Queue.new
end
def Log(messages)
View
9 spec/lib/extras/queued_log_message_handler_spec.rb
@@ -44,4 +44,13 @@
subject.queue.size.should eq(1)
end
end
+
+ context "with a custom queue" do
+ let(:queue) { Queue.new }
+ subject { described_class.new("Test Handler", :queue => queue) }
+
+ it "accepts a custom queue object" do
+ subject.queue.should equal(queue)
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.