Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-07-26 19:35:15 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-07-26 19:36:04 +0300
commit656985bf75ff2a3fd2c0f8eb88fa78847a529980 (patch)
tree9de850119b2cffb16b6905dce81ed9cbdb60b453 /spec/support
parent0da5c588b1d7f3bf16f535d1f29d721aa19bd142 (diff)
Make authentication metrics events explicit is specs
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/stub_metrics.rb1
-rw-r--r--spec/support/prometheus/custom_matchers.rb8
2 files changed, 7 insertions, 2 deletions
diff --git a/spec/support/helpers/stub_metrics.rb b/spec/support/helpers/stub_metrics.rb
index 53abf33f2e5..d882346ec52 100644
--- a/spec/support/helpers/stub_metrics.rb
+++ b/spec/support/helpers/stub_metrics.rb
@@ -7,7 +7,6 @@ module StubMetrics
authentication_metrics.each_counter do |name, metric, description|
double("#{metric} - #{description}").tap do |counter|
allow(authentication_metrics).to receive(name).and_return(counter)
- allow(counter).to receive(:increment) # TODO, require expectations
end
end
diff --git a/spec/support/prometheus/custom_matchers.rb b/spec/support/prometheus/custom_matchers.rb
index 52ce8d2e48d..22d5cd17e3f 100644
--- a/spec/support/prometheus/custom_matchers.rb
+++ b/spec/support/prometheus/custom_matchers.rb
@@ -1,5 +1,11 @@
RSpec::Matchers.define :increment do |counter|
match do |adapter|
- expect(adapter.send(counter)).to receive(:increment)
+ expect(adapter.send(counter))
+ .to receive(:increment)
+ .exactly(@exactly || :once)
+ end
+
+ chain :twice do
+ @exactly = :twice
end
end