4 ms·
There is no value in a test like this. This is basically a test of a precondition (object must be valid). In fact there is not much value in the entire if stat
by gwright 10y ago
There is no value in a test like this. This is basically a test of a precondition (object must be valid). In fact there is not much value in the entire if statement since it is also testing a precondition. That leaves:
def create(object)
factory.save(object)
end
which is just simple delegation. Perhaps just inline the call to create and get rid of the entire class, method, and tests.
It is a waste of time testing for a pre-condition. Ensuring a pre-condition is the responsibility of the caller and tests in that part of the code, or integration tests, should be responsible for identifying problems in that regard.