Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add benchmark that runs a spec with many examples

  • Loading branch information...
commit 83a299f28fff761894ca4c635ae5214e032170ff 1 parent aab0cba
@dchelimsky dchelimsky authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 benchmarks/filter_object.rb
View
35 benchmarks/filter_object.rb
@@ -0,0 +1,35 @@
+require 'benchmark'
+require 'tmpdir'
+
+path = File.join(Dir.tmpdir, "benchmark_example_spec.rb")
+
+File.open(path, 'w') do |f|
+ f.puts %q|describe "something" do|
+ 100.times do |n|
+ f.puts <<-TEXT
+ it "does something #{n}", :focus => true do
+ end
+TEXT
+ end
+ 100.times do |n|
+ f.puts <<-TEXT
+ it "does something else #{n}" do
+ end
+TEXT
+ end
+ f.puts %q|end|
+end
+
+n = 1
+
+Benchmark.benchmark do |bm|
+ 3.times do
+ bm.report do
+ n.times do
+ `bin/rspec --tag focus #{path}`
+ end
+ end
+ end
+end
+
+File.delete(path)
Please sign in to comment.
Something went wrong with that request. Please try again.