active_storage_validations
active_storage_validations copied to clipboard
validate_aspect_ratio_of show wrong number of arguments (given 1, expected 2)
I have define this in mi model:
validates :cover, attached: true,
content_type: %i[png jpeg],
aspect_ratio: :square,
dimension: { width: { min: 400, max: 1200 } }
And in the Rspec
it { is_expected.to validate_aspect_ratio_of(:cover).allowing(:square) }
and obtain this the execute the test:
I show the code, and I don't understand what it's the problem with this validation.
Thanks for your work
@sbrocos there's an issue with the initialization of the matcher class ActiveStorageValidations::Matchers::AspectRatioValidatorMatcher
. As a workaround you can do this:
it { is_expected.to ActiveStorageValidations::Matchers::AspectRatioValidatorMatcher.new(:cover).allowing(:square) }
Hope this helps! o/
Hi @sbrocos, I'll have a look at it, seems like an easy bug to fix.
Hi @sbrocos & @osmarluz, Thanks for the bug report, it has been corrected, it should be available in the new gem version soon :)