diff options
author | Stan Hu <stanhu@gmail.com> | 2017-11-08 03:14:11 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-11-08 10:58:17 +0300 |
commit | af0dddbf1015bc96e0b51ffb9172fc0c5567323a (patch) | |
tree | 70a48034405c0f4ca368c73dc136fbea1db1c2dd | |
parent | ac4a976c5ff77a1327345245b91e8e0ca5601b9d (diff) |
Fix NoMethodError due to protected method `labels` when trying to use metricssh-fix-protected-method-labels-error
Closes gitlab-org/gitlab-ee#3949
-rw-r--r-- | lib/gitlab/metrics/background_transaction.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/metrics/background_transaction_spec.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/metrics/background_transaction.rb b/lib/gitlab/metrics/background_transaction.rb index d01de5eef0a..5919ebb1493 100644 --- a/lib/gitlab/metrics/background_transaction.rb +++ b/lib/gitlab/metrics/background_transaction.rb @@ -6,8 +6,6 @@ module Gitlab @worker_class = worker_class end - protected - def labels { controller: @worker_class.name, action: 'perform' } end diff --git a/spec/lib/gitlab/metrics/background_transaction_spec.rb b/spec/lib/gitlab/metrics/background_transaction_spec.rb index 96052b8dc2f..19f504d8b61 100644 --- a/spec/lib/gitlab/metrics/background_transaction_spec.rb +++ b/spec/lib/gitlab/metrics/background_transaction_spec.rb @@ -10,4 +10,10 @@ describe Gitlab::Metrics::BackgroundTransaction do expect(subject.action).to eq('TestWorker#perform') end end + + describe '#labels' do + it 'returns controller name' do + expect(subject.labels).to eq({ controller: 'TestWorker', action: 'perform' }) + end + end end |