diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-05-23 17:16:23 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-02 20:45:58 +0300 |
commit | 394e962e52efdff36e3fae974ea51e9e2883f382 (patch) | |
tree | e0dd8e5144732c1a239f5c81a2d30700baffc52a /spec/lib/gitlab/metrics_spec.rb | |
parent | ef9f23b797d7467a1d1bda15e29d1f33b070065f (diff) |
Make tests of Gitlab::Metrics use explicit descriptions.
Diffstat (limited to 'spec/lib/gitlab/metrics_spec.rb')
-rw-r--r-- | spec/lib/gitlab/metrics_spec.rb | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/spec/lib/gitlab/metrics_spec.rb b/spec/lib/gitlab/metrics_spec.rb index 020bdbacead..863868e1576 100644 --- a/spec/lib/gitlab/metrics_spec.rb +++ b/spec/lib/gitlab/metrics_spec.rb @@ -9,19 +9,19 @@ describe Gitlab::Metrics do describe '.enabled?' do it 'returns a boolean' do - expect([true, false].include?(described_class.enabled?)).to eq(true) + expect(described_class.enabled?).to be_in([true, false]) end end describe '.prometheus_metrics_enabled?' do it 'returns a boolean' do - expect([true, false].include?(described_class.prometheus_metrics_enabled?)).to eq(true) + expect(described_class.prometheus_metrics_enabled?).to be_in([true, false]) end end describe '.influx_metrics_enabled?' do it 'returns a boolean' do - expect([true, false].include?(described_class.influx_metrics_enabled?)).to eq(true) + expect(described_class.influx_metrics_enabled?).to be_in([true, false]) end end @@ -195,9 +195,17 @@ describe Gitlab::Metrics do subject { described_class.counter(:couter, 'doc') } describe '#increment' do - it { expect { subject.increment }.not_to raise_exception } - it { expect { subject.increment({}) }.not_to raise_exception } - it { expect { subject.increment({}, 1) }.not_to raise_exception } + it 'successfully calls #increment without arguments' do + expect { subject.increment }.not_to raise_exception + end + + it 'successfully calls #increment with 1 argument' do + expect { subject.increment({}) }.not_to raise_exception + end + + it 'successfully calls #increment with 2 arguments' do + expect { subject.increment({}, 1) }.not_to raise_exception + end end end @@ -205,15 +213,19 @@ describe Gitlab::Metrics do subject { described_class.summary(:summary, 'doc') } describe '#observe' do - it { expect { subject.observe({}, 2) }.not_to raise_exception } + it 'successfully calls #observe with 2 arguments' do + expect { subject.observe({}, 2) }.not_to raise_exception + end end end describe '#gauge' do subject { described_class.gauge(:gauge, 'doc') } - describe '#observe' do - it { expect { subject.set({}, 1) }.not_to raise_exception } + describe '#set' do + it 'successfully calls #set with 2 arguments' do + expect { subject.set({}, 1) }.not_to raise_exception + end end end @@ -221,7 +233,9 @@ describe Gitlab::Metrics do subject { described_class.histogram(:histogram, 'doc') } describe '#observe' do - it { expect { subject.observe({}, 2) }.not_to raise_exception } + it 'successfully calls #observe with 2 arguments' do + expect { subject.observe({}, 2) }.not_to raise_exception + end end end end |