Commit 2fa4e2fb authored by Yorick Peterse's avatar Yorick Peterse

Evaluate benchmark blocks in the proper context

This ensures that blocks defines using "benchmark_subject" have access
to methods defined using let/subject & friends.
parent 39772f01
......@@ -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]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment