diff options
Diffstat (limited to 'spec/lib/gitlab/metrics/background_transaction_spec.rb')
-rw-r--r-- | spec/lib/gitlab/metrics/background_transaction_spec.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/lib/gitlab/metrics/background_transaction_spec.rb b/spec/lib/gitlab/metrics/background_transaction_spec.rb index 84f405d7369..640bbebf0da 100644 --- a/spec/lib/gitlab/metrics/background_transaction_spec.rb +++ b/spec/lib/gitlab/metrics/background_transaction_spec.rb @@ -2,14 +2,23 @@ require 'spec_helper' -describe Gitlab::Metrics::BackgroundTransaction do +RSpec.describe Gitlab::Metrics::BackgroundTransaction do let(:test_worker_class) { double(:class, name: 'TestWorker') } subject { described_class.new(test_worker_class) } describe '#label' do it 'returns labels based on class name' do - expect(subject.labels).to eq(controller: 'TestWorker', action: 'perform') + expect(subject.labels).to eq(controller: 'TestWorker', action: 'perform', feature_category: '') + end + + it 'contains only the labels defined for metrics' do + expect(subject.labels.keys).to contain_exactly(*described_class.superclass::BASE_LABELS.keys) + end + + it 'includes the feature category if there is one' do + expect(test_worker_class).to receive(:get_feature_category).and_return('source_code_management') + expect(subject.labels).to include(feature_category: 'source_code_management') end end end |