active_storage_validations icon indicating copy to clipboard operation
active_storage_validations copied to clipboard

Specs not recognising the on method (thus can't scope validations to update in specs)

Open ernest4 opened this issue 5 years ago • 1 comments

Hi :) great work on the gem!

I have a validation that I only want to run on update. The validation does run on update as I expect, however the specs don't look like they recognise the on method. So basically can't use the specs to check for validation on update, only on create (default).

Screenshot 2020-10-01 at 13 26 02 Screenshot 2020-10-01 at 13 25 52

I'm surprised no one brought this up yet as I'd imagine this would be fairly common. Unless there's some work around for this? But I haven't spotted any?

If there's a workaround, could you please let me know. Otherwise, could this be added to specs :)

Thanks.

ernest4 avatar Oct 01 '20 12:10 ernest4

I guess, matcher in the gem doesn't support this option so I think the best is to fork a gem and make a fix 👍

igorkasyanchuk avatar Oct 01 '20 13:10 igorkasyanchuk

Hi @ernest4, Thanks for bringing it up, We recently had a discussion on adding a #onmethod on our matchers in order to perform the test you are mentioning in #215. I am therefore closing your ticket so we don't have a duplicate. Feel free to drop a PR on #215 if you want to contribute 🙌

Mth0158 avatar Nov 21 '23 11:11 Mth0158