It is a while since I gave this presentation about the expectation ruby gem. In short: the expectation gem lets you add assertions directly into the code. This will help you catch a specific class of coding errors much faster – those where different components of an application are developed separately and forget about the finer details of their respective interfaces.

Expectations look like this:

def function(a, b, options = {})
  expect! a => /^http:/, b => [Integer, Float], 
    options => {
      :foo => String,
      :bar => [ Array, nil ]

If you missed the presentation, you may revisit it here.