Saving a record in a controller has at least two outcomes: it can succeed or it
can fail and you want to test this branching.
In order to decouple a functional test from the concrete attributes or other
states that define its validity, it’s good to skip the actual validation
and stub it out instead.
Stubbing a failing record for a create or update request is fairly easy for
a vanilla controller:
However, it isn’t that easy with inherited_recources.
(or more accurately with responders which is used
behind the scenes). Inherited Resources considers a record invalid when it has errors (see also
this issue).
Here is an approach to properly stub record validity for use with Inherited Resources: