summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2015-10-05 16:26:37 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2015-10-05 16:27:41 +0200
commit2fa4e2fb6a669b98ed6abc568eabc8f5f9f28e8a (patch)
tree66fb4f0bdd0a78606019754687a68279e66653ee
parent39772f0116276c8b3625e22150bc518754077a6b (diff)
downloadgitlab-ce-2fa4e2fb6a669b98ed6abc568eabc8f5f9f28e8a.tar.gz
Evaluate benchmark blocks in the proper context
This ensures that blocks defines using "benchmark_subject" have access to methods defined using let/subject & friends.
-rw-r--r--spec/support/matchers/benchmark_matchers.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/spec/support/matchers/benchmark_matchers.rb b/spec/support/matchers/benchmark_matchers.rb
index b73a53917f0..84f655c2119 100644
--- a/spec/support/matchers/benchmark_matchers.rb
+++ b/spec/support/matchers/benchmark_matchers.rb
@@ -38,7 +38,9 @@ module BenchmarkMatchers
# Benchmarks the given block and returns a Benchmark::IPS::Report::Entry.
def benchmark(&block)
report = Benchmark.ips(quiet: true) do |bench|
- bench.report(&block)
+ bench.report do
+ instance_eval(&block)
+ end
end
report.entries[0]