Evaluate benchmark blocks in the proper context
This ensures that blocks defines using "benchmark_subject" have access to methods defined using let/subject & friends.
This commit is contained in:
parent
39772f0116
commit
2fa4e2fb6a
|
@ -38,7 +38,9 @@ module BenchmarkMatchers
|
||||||
# Benchmarks the given block and returns a Benchmark::IPS::Report::Entry.
|
# Benchmarks the given block and returns a Benchmark::IPS::Report::Entry.
|
||||||
def benchmark(&block)
|
def benchmark(&block)
|
||||||
report = Benchmark.ips(quiet: true) do |bench|
|
report = Benchmark.ips(quiet: true) do |bench|
|
||||||
bench.report(&block)
|
bench.report do
|
||||||
|
instance_eval(&block)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
report.entries[0]
|
report.entries[0]
|
||||||
|
|
Loading…
Reference in New Issue