summaryrefslogtreecommitdiff
path: root/spec/support/matchers/metric_counter_matcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/matchers/metric_counter_matcher.rb')
-rw-r--r--spec/support/matchers/metric_counter_matcher.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/support/matchers/metric_counter_matcher.rb b/spec/support/matchers/metric_counter_matcher.rb
new file mode 100644
index 00000000000..22d5cd17e3f
--- /dev/null
+++ b/spec/support/matchers/metric_counter_matcher.rb
@@ -0,0 +1,11 @@
+RSpec::Matchers.define :increment do |counter|
+ match do |adapter|
+ expect(adapter.send(counter))
+ .to receive(:increment)
+ .exactly(@exactly || :once)
+ end
+
+ chain :twice do
+ @exactly = :twice
+ end
+end