RSpec - IT House RSpec - IT House


Technologies used by IT House

RSpec is a software code testing tool for Ruby, commonly called a Behaviour Driven Development (BDD) framework for Ruby. It was created in 2005 by by Steven Baker, with early contributions from Dave Astels and Aslak Hellesøy.

Here “R” stands for Ruby, but “Spec” is for Specification. “Spec” is an executable example that test whether a portion of code exhibits the expected behavior in a controlled context.

RSpec is testing behavior rather than specific methods.

In a nutshell RSpec allows testing in 3 simple steps:

  • Given some context
  • When some event occurs
  • Expect some outcome

To test an application for errors, it is necessary to let it run with different variations of data and evaluate if the results are consistent with what’s expected. RSpec makes it possible to automate most of the testing activities.

It will not only test a newly written snippet of code, to check it’s consistency, but it also enables the developers to quickly re-check the whole project after each update, to make sure that new changes do not break the functionality of previous ones.

RSpec uses very special syntax and method names to make the test code more human readable. This gives the developer a better understanding of the test and makes it easier to read, and change if necessary.

IT House uses RSpec extensively to test every critical functionality before delivering any application to a production environment. It not only allows us to catch and fix software bugs before they reach production, but it also creates a strong software integrity, protecting existing functionality by testing all current functions before adding a new one.