deputy 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/deputy.gemspec +1 -1
- data/lib/deputy.rb +4 -2
- data/spec/deputy_spec.rb +6 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.25
|
data/deputy.gemspec
CHANGED
data/lib/deputy.rb
CHANGED
@@ -114,8 +114,10 @@ module Deputy
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def self.send_report(metric, value)
|
117
|
-
|
118
|
-
|
117
|
+
# TODO sheriff does not accept anything else, fix it...
|
118
|
+
metric = metric.split('.',2)
|
119
|
+
metric = metric.map{|m| m.gsub(/[^-_a-zA-Z]/, '_') } * '.'
|
120
|
+
get "/report/#{metric}?value=#{CGI.escape value.to_s}"
|
119
121
|
end
|
120
122
|
|
121
123
|
def self.get(path)
|
data/spec/deputy_spec.rb
CHANGED
@@ -155,5 +155,11 @@ describe Deputy do
|
|
155
155
|
FakeWeb.register_uri(:get, "http://sheri.ff/report/Xxx.yyy?value=123", :body => 'OK')
|
156
156
|
Deputy.send_report('Xxx.yyy', '123').should == 'OK'
|
157
157
|
end
|
158
|
+
|
159
|
+
it "escapes metric names" do
|
160
|
+
Deputy.stub!(:sheriff_url).and_return 'http://sheri.ff'
|
161
|
+
FakeWeb.register_uri(:get, "http://sheri.ff/report/X_xx.yy___y?value=123", :body => 'OK')
|
162
|
+
Deputy.send_report('X/xx.yy/./y', '123').should == 'OK'
|
163
|
+
end
|
158
164
|
end
|
159
165
|
end
|