stew(@)rtmatheson.com

Thoughts on Rails, Ruby, and Javascript

Introducing Assert-random

Something I have been meaning to do for a long time now is create and release a ruby gem. Today I have done this. Introducing assert-random. Its a VERY simple gem that adds an assertion to test/unit. Assert random as a test accepts a block and runs this block 10 times. Once the block has been run it then checks the results of the block. Currently it tests to make sure that no objects that are the result of the block match. Not much but its a start. Example that passes:
assert_random do
    rand(1000)
end
Example that fails:
assert_random do
    1000
end
Basic stuff but I plan to extend it in the future so something like this will fail:
counter = 1
assert_random do
    counter += 1
end
I used the gem Jeweler. I got up and running very quickly and was able to focus on the functionality of the gem and not all of the meta details a gem needs. All that was generated for me. Awesome really. Source: http://github.com/stewartmatheson/assert-random RubyGem: http://rubygems.org/gems/assert-random