My user check seems to be done before my before_save block, which is strange to me. I know before_validation , but I'm trying to test my own validator, so the before_validation hook will not let me do this. I also read that testing a private method (my validator) is bad practice. What should I do?
Additional information: we want users to be able to upload a document with a URL or file, but not with both, or with a nickname (xor). My validator checks them. If the user edits a document, the before_save hook deletes the current URL or file. Theoretically, the stream should be:
- Upload file
- Confirm and save
- Download URL
- before_save, check, save
But in my tests, I get validation errors, assuming that before_save does not occur.
Monti source share