🕷 zenspider.com

by ryan davis



sitemap
Looking for the Ruby Quickref?

LOLtests show rspec 2x slower than minitest

Published 2012-06-15 @ 14:55

Tagged minitest

via tenderlove

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if $0 =~ /rspec$/
  describe 'loltest' do
    10_000.times do |i|
      it "does #{i}" do
        i.should == i
      end
    end
  end
else
  require 'minitest/autorun'

  describe 'loltest' do
    10_000.times do |i|
      it "does #{i}" do
        i.must_equal i
      end
    end
  end
end
$ time ruby spec.rb

[ dots omitted ]

Finished tests in 0.911317s, 10973.1301 tests/s, 10973.1301 assertions/s.

10000 tests, 10000 assertions, 0 failures, 0 errors, 0 skips

real	0m1.488s
user	0m1.255s
sys	0m0.132s

$ time rspec spec.rb

[ dots omitted ]

Finished in 1.82 seconds
10000 examples, 0 failures

real	0m3.238s
user	0m2.755s
sys	0m0.241s

$ ruby -v
ruby 2.0.0dev (2012-06-09 trunk 35969) [x86_64-darwin11.4.0]