Wednesday, July 13, 2016

An example of using dynamic fact descriptions in Midje

I had these tests written in Midje which had some duplication:

but were providing a nice level of feedback when there was an error:

In my first attempt to remove the duplication in the facts:

I lost the level of feedback the original tests had. It didn't tell which sorter was failing:

By using dynamic fact descriptions (notice the use of the :midje/description metada):

I was able to keep the original level of feedback and still remove the duplication:

No comments:

Post a Comment