Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Forked from tenderlove/spec.rb
Created June 15, 2012 22:14
Show Gist options
  • Save dchelimsky/2938965 to your computer and use it in GitHub Desktop.
Save dchelimsky/2938965 to your computer and use it in GitHub Desktop.
# Note the differences between this and https://gist.github.com/2938822 are that
# we're making 10k groups with 1 example each vs 1 group w/ 10k examples, and the
# rspec example uses "should eq" instead of "should =="
if $0 =~ /rspec$/
10_000.times do |i|
describe "loltest #{i}" do
it "does #{i}" do
i.should eq i
end
end
end
else
require 'minitest/autorun'
10_000.times do |i|
describe "loltest #{i}" do
it "does #{i}" do
i.must_equal i
end
end
end
end
__END__
On my machine:
$ time ruby spec.rb
Run options: --seed 29086
# Running tests:
[dots omitted]
Finished tests in 2.930095s, 3412.8586 tests/s, 3412.8586 assertions/s.
10000 tests, 10000 assertions, 0 failures, 0 errors, 0 skips
real 0m5.038s
user 0m4.931s
sys 0m0.108s
$ time rspec spec.rb
[dots omitted]
Finished in 2.35 seconds
10000 examples, 0 failures
Randomized with seed 59780
real 0m4.358s
user 0m4.153s
sys 0m0.204s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment