Permalink
Browse files

add tests for set support

  • Loading branch information...
1 parent d7d016a commit c2590f852a28c05099ed481b54729d2783eb5b59 @disaacs disaacs committed Feb 6, 2014
Showing with 13 additions and 0 deletions.
  1. +13 −0 test/statsd_test.rb
View
@@ -38,6 +38,11 @@ def test_statsd_gauge
StatsD.gauge('values.foobar', 12)
end
+ def test_statsd_set
+ StatsD.expects(:collect).with('values.foobar', 12, :s, 1.0, nil)
+ StatsD.set('values.foobar', 12)
+ end
+
def test_statsd_histogram_on_datadog
StatsD.stubs(:implementation).returns(:datadog)
StatsD.expects(:collect).with('values.hg', 12.33, :h, 0.2, ['tag_123', 'key-name:value123'])
@@ -76,6 +81,14 @@ def test_supports_gauge_syntax
StatsD.gauge('fooy', 42, 0.01)
end
+ def test_supports_set_syntax
+ StatsD.expects(:write_packet).with('unique:10.0.0.10|s')
+ StatsD.set('unique', '10.0.0.10')
+
+ StatsD.expects(:write_packet).with('unique:10.0.0.10|s|@0.01')
+ StatsD.set('unique', '10.0.0.10', 0.01)
+ end
+
def test_support_timing_syntax
StatsD.expects(:write_packet).with('duration:1.23|ms')
StatsD.measure('duration', 1.23)

0 comments on commit c2590f8

Please sign in to comment.