Assertions for repeatedly testing conditions in Ruby
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.document
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION
assert_repeated.gemspec

README.rdoc

assert_repeated

Assertions that run multiple times, used to smoke-test or randomly probe a function with a large domain.

assert_repeatedly_true(1000) do
  expected = rand(100)
  actual = decrypt(encrypt(expected))
  expected == actual
end

assert_repeatedly_false(10) do
  !she_loves_me
end

assert_repeatedly(100_000, /awesome/) do
  "writing tests is awesome!"
end

This is way better than running assert in a loop because it doesn't blow up the assertion counter:

45 tests, 1089 assertions, 0 failures, 0 errors

Note on Patches/Pull Requests

  • Fork the project.

  • Add tests for your feature addition or bug fix.

  • Commit.

  • Make the tests pass.

  • Commit.

  • Send me a pull request.

Copyright

Copyright © 2009 Bryce Kerley and Todd Willey.

DO WHATEVER YOU WANT WITH THIS SOFTWARE; see LICENSE for details.