Welcome to the Typeform assert gem! This gem provides a useful module to include when writing tests, which allows for readable assertions to be made.


Add this line to your application's Gemfile:

gem 'assert', git: ''


Recommended usage:

Once you have performed the actions in your test, you can use the module to check that the result is as expected. A simple example is this, lets say you have two variables and you want to check that they are the same. You can use the assert module as follows.

assert 'var1 is equal to var2', var1, var2, :&==

If they are not equal this error message would be displayed 'Failed asserting that var1 is equal to var2', as well as the arguments passed to assert and the error itself.

A more complex and practical testing example, lets say you have two objects and you want to check certain attributes of these objects are the same. For example, the object Car with attributes make, model and colour. Imagine for testing purposes we only care about the make and the model being the same. You could use the assert module as follows.

assert 'the expected car is equal to the actual car' expected_car, actual_car do |expected, actual|
    expected.make == actual.make &&
    expected.model == actual.model


After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at[USERNAME]/assert.