diff options
| author | Rémy Coutable <remy@rymai.me> | 2016-04-13 10:02:30 +0000 |
|---|---|---|
| committer | Rémy Coutable <remy@rymai.me> | 2016-04-13 10:02:30 +0000 |
| commit | bbf49ffca1c1be65567afa76961d176e57d40150 (patch) | |
| tree | b373e267de36e005d5b972a54175722104c18ab8 /spec | |
| parent | e83424a13e1b5d2e55ae5bd0aeae6a4c5f88262a (diff) | |
| parent | 3240ecfbefc7ae5994be6ef01b52c1cbdaa09057 (diff) | |
| download | gitlab-ce-bbf49ffca1c1be65567afa76961d176e57d40150.tar.gz | |
Merge branch 'custom-transaction-tags' into 'master'
Added ability to add custom tags to transactions
cc @pcarranza
See merge request !3674
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/lib/gitlab/metrics_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/gitlab/metrics_spec.rb b/spec/lib/gitlab/metrics_spec.rb index 3dee13e27f4..10177c0e8dd 100644 --- a/spec/lib/gitlab/metrics_spec.rb +++ b/spec/lib/gitlab/metrics_spec.rb @@ -98,4 +98,29 @@ describe Gitlab::Metrics do end end end + + describe '.tag_transaction' do + context 'without a transaction' do + it 'does nothing' do + expect_any_instance_of(Gitlab::Metrics::Transaction). + not_to receive(:add_tag) + + Gitlab::Metrics.tag_transaction(:foo, 'bar') + end + end + + context 'with a transaction' do + let(:transaction) { Gitlab::Metrics::Transaction.new } + + it 'adds the tag to the transaction' do + expect(Gitlab::Metrics).to receive(:current_transaction). + and_return(transaction) + + expect(transaction).to receive(:add_tag). + with(:foo, 'bar') + + Gitlab::Metrics.tag_transaction(:foo, 'bar') + end + end + end end |
