Read more

The Self-Contained Test

Henning Koch
June 02, 2020Software engineer at makandra GmbH

One of the earliest pieces of wisdom we are given as programmers is to not write duplicate code: Don’t Repeat Yourself (or DRY if you prefer). Identical blocks of code to set up a test sure does look like repetition, so we extract it into a before block.

This is a mistake for tests.

The article explains about how sharing setup between examples make test files harder to read and evolve.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

A related frustration I have is working on ultra-DRY & betterspecs-like test files where shared setup has worked for all existing tests, but won't work for the test I need to add. I now need to refactor a huge file to add a small test.

Posted by Henning Koch to makandra dev (2020-06-02 09:16)