Permalink
Browse files

Merge pull request #33 from mzsanford/configure_batch_parameters

Allow setting the host and port on a Statsd::Batch object
  • Loading branch information...
2 parents 4989ea4 + 4ac9871 commit 609b6f97a1496769ceb1b22c4b9b6d1541571bbc @raggi raggi 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
@@ -333,6 +333,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 609b6f9

Please sign in to comment.