diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2015-10-05 17:26:37 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2015-10-05 17:27:41 +0300 |
commit | 2fa4e2fb6a669b98ed6abc568eabc8f5f9f28e8a (patch) | |
tree | 66fb4f0bdd0a78606019754687a68279e66653ee /spec/support/matchers | |
parent | 39772f0116276c8b3625e22150bc518754077a6b (diff) |
Evaluate benchmark blocks in the proper context
This ensures that blocks defines using "benchmark_subject" have access
to methods defined using let/subject & friends.
Diffstat (limited to 'spec/support/matchers')
-rw-r--r-- | spec/support/matchers/benchmark_matchers.rb | 4 |
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] |