- Assume there are functional specs as well, but they don't need to be changed to add this feature. Marking an invoice as paid is a PUT /invoices/123 with data
{ 'invoice' => { 'state' => 'paid' } }
. - The view has been modified to display the "paid" badge, which uses
invoice.paid?
.
The main issue with this example, to me, is excessive unit testing. Is it worth the time to test Invoice#paid?
in this manner? Requiring such test coverage can lead to laziness to avoid tests--you could do this by writing invoice.state == 'paid'
in the view. The tests are also closely tied to the implementation (since the implementation is so simple).