Skip to content
Snippets Groups Projects
Commit 2fa4e2fb authored by Yorick Peterse's avatar Yorick Peterse
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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]
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment