Pruebas. Test Driven Development (TDD) y Rspec

Test-Driven Development (TDD) is a practice designed to force developers to think about their code before writing it (Kent Beck).

This is done in small increments in which the developer must identify increasingly more-complex interfaces to other objects as well as build up the functionality of the object under development.

Here's the flow for development with RSpec:

  1. You write a test. This test describes the behavior of a small element of your system.
  2. You run the test. The test fails because you have not yet built the code for that part of your system. This important step tests your test case, verifying that your test case fails when it should.
  3. You write enough code to make the test pass.
  4. You run the tests and verify that they pass.
In essence, a RSpec developer turns test cases from red (failing) to green (passing) all day.

Vídeos sobre TDD

Casiano Rodriguez León 2015-01-07