It Just Feels Better

I've come to hate the assert_* syntax when writing tests:

should "be able to produce the correct sound" do
  bot = Bot.new
  assert_equal 'bleep', bot.bleep
end

This is my preferred method because it's faster and just "feels better" (thanks, Matt):

it "should be able to produce the correct sound" do
  bot = Bot.new
  bot.bleep.should == 'bleep'
end

If you like this syntax better, check out my throat-punch gem and pull it into your Ruby projects. It's just a simple way to wrap some my favorite Ruby testing tools: context, matchy, and mocha (which you should check out as well).

blog comments powered by Disqus