summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/workers/metrics_worker.rb2
-rw-r--r--spec/workers/metrics_worker_spec.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/app/workers/metrics_worker.rb b/app/workers/metrics_worker.rb
index 8fffe371572..90a65579382 100644
--- a/app/workers/metrics_worker.rb
+++ b/app/workers/metrics_worker.rb
@@ -24,6 +24,6 @@ class MetricsWorker
end
def escape_value(value)
- value.gsub('=', '\\=')
+ value.to_s.gsub('=', '\\=')
end
end
diff --git a/spec/workers/metrics_worker_spec.rb b/spec/workers/metrics_worker_spec.rb
index 0d12516c1a3..f5650494c7c 100644
--- a/spec/workers/metrics_worker_spec.rb
+++ b/spec/workers/metrics_worker_spec.rb
@@ -36,5 +36,9 @@ describe MetricsWorker do
it 'escapes an equals sign' do
expect(worker.escape_value('foo=')).to eq('foo\\=')
end
+
+ it 'casts values to Strings' do
+ expect(worker.escape_value(10)).to eq('10')
+ end
end
end