Home

Awesome

Iba

by Matijs van Zuijlen

Description

Introspective Block Assertions

Features/Problems

Synopsis

# In your test helper:
require 'iba'
class Test::Unit::TestCase
  include Iba::BlockAssertion
end

# In your test:
foo = 24
assert { foo == 23 } # => "(foo == 23) is false
                     #     foo is 24."

Details

Iba provides an assert method that takes a block. If the block returns false, it will try to construct an insightful error message based on the contents of the block.

Iba's functionality is inspired by Wrong, but doesn't use an external Ruby parser. This means it will work in contexts where Wrong does not (generated code, on the command line). It also means there are more limits to the contents of the block.

Current limits:

Iba's implementation is inspired by Arlo, a generic combinator library for Python. The implementation of Arlo is now on github.

Install

gem install iba
<!-- Links -->

Licence

See the LICENSE file