Permalink
Browse files

Allow setting the host and port on a Statsd::Batch object

  • Loading branch information...
1 parent 24fc9d0 commit 4ac987119b2ea51a879ac383075ed90343cde406 @mzsanford mzsanford committed Dec 21, 2012
Showing with 23 additions and 1 deletion.
  1. +5 −1 lib/statsd.rb
  2. +18 −0 spec/statsd_spec.rb
View
@@ -43,7 +43,11 @@ class Batch < Statsd
extend Forwardable
def_delegators :@statsd,
- :namespace, :namespace=, :host, :port, :prefix, :postfix
+ :namespace, :namespace=,
+ :host, :host=,
+ :port, :port=,
+ :prefix,
+ :postfix
attr_accessor :batch_size
View
@@ -321,6 +321,24 @@ class Statsd::SomeClass; end
@socket.recv.must_equal %w[foobar:1|c]
end
+ it "should support setting namespace for the underlying instance" do
+ batch = Statsd::Batch.new(@statsd)
+ batch.namespace = 'ns'
+ @statsd.namespace.must_equal 'ns'
+ end
+
+ it "should support setting host for the underlying instance" do
+ batch = Statsd::Batch.new(@statsd)
+ batch.host = '1.2.3.4'
+ @statsd.host.must_equal '1.2.3.4'
+ end
+
+ it "should support setting port for the underlying instance" do
+ batch = Statsd::Batch.new(@statsd)
+ batch.port = 42
+ @statsd.port.must_equal 42
+ end
+
end
describe "thread safety" do

0 comments on commit 4ac9871

Please sign in to comment.