Commit 5142c617 authored by Yorick Peterse's avatar Yorick Peterse

Cast values to strings before escaping them

This ensures that e.g. line numbers used in tags are first casted to
strings.
parent 9f95ff0d
...@@ -24,6 +24,6 @@ class MetricsWorker ...@@ -24,6 +24,6 @@ class MetricsWorker
end end
def escape_value(value) def escape_value(value)
value.gsub('=', '\\=') value.to_s.gsub('=', '\\=')
end end
end end
...@@ -36,5 +36,9 @@ describe MetricsWorker do ...@@ -36,5 +36,9 @@ describe MetricsWorker do
it 'escapes an equals sign' do it 'escapes an equals sign' do
expect(worker.escape_value('foo=')).to eq('foo\\=') expect(worker.escape_value('foo=')).to eq('foo\\=')
end end
it 'casts values to Strings' do
expect(worker.escape_value(10)).to eq('10')
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment