Using Discipline would allow us to define and test laws for typeclasses, such as a Repository typeclass. This means we can write the tests once and use them to test both the live and fake implementations.
Repository laws:
For every saved Job, j, find(id(j)) returns j
For every saved Job, j, all() includes j
For every saved Job, j, with state, s, and then updated to state s' is equivalent to saving a job with state s'.
Using Discipline would allow us to define and test laws for typeclasses, such as a Repository typeclass. This means we can write the tests once and use them to test both the live and fake implementations.
Repository laws:
j
,find(id(j))
returnsj
j
,all()
includesj
j
, with state,s
, and then updated to states'
is equivalent to saving a job with states'
.