opened
StefSchenkelaars
username_0
I worked on a first version of the test matchers as requested in https://github.com/username_1/active_storage_validations/issues/48. For now I've only implemented:
- `AttachedValidatorMatcher`
- `ContentTypeValidatorMatcher`
- `DimensionValidatorMatcher`
- `SizeValidatorMatcher`

and they should also be extended more to test all options of the validators (like message and validation context). But I hope it is a starting point and that we can add a complete set of matchers for all validators. 

I will also write some usage information in the readme before marking the PR ready for review.
Add test matchers for validators
issue
created
igorkasyanchuk
username_1
@username_0 this is great news, as I see it's created for mini-test, which I think good start. Maybe you or someone else in the future could implement the same for RSpec.
comment
created
StefSchenkelaars
username_0
@username_1 Well, I actually build it to work with `RSpec` since that what we use. I am not an expert in minitest but I think they should also work with minitest.
comment
created
StefSchenkelaars
username_0
I've tested the matchers with minitest and the shoulda context gem. Everything worked as expected and I've updated the readme accordingly.
comment
created
igorkasyanchuk
username_1
This is fantastic!
comment
created
igorkasyanchuk
username_1
let me know if you think it's ready for a review
comment
created
StefSchenkelaars
username_0
Worked a bit on making sure that the stubbing works with both Minitest and RSpec. I now think that works. Also made sure that de dimension validator matcher works with exact matches. 

As I said before, there is plenty of work to be done to make the matchers great but they help me quite a bit already in the current state. 

But it would be great if you can do a code review! 

And a bit unrelated is the rubocop. I ran it on the codebase and there where many failures. But I leave that up to another PR to fix (guess it's a good idea to add rubocop to travis)
comment
created
igorkasyanchuk
username_1
merged and released a new version. Thank you
comment
created
connorshea
username_2
This is great, thanks! 👍 

FWIW, pundit-matchers auto-includes itself if the matcher file is required, not sure if there are downsides to that but I figured I'd mention it: https://github.com/chrisalley/pundit-matchers/blob/00c89e7fa1f4dde6f2ad0c03a79db629a8f99e3e/lib/pundit/matchers.rb#L347-L351
comment
created
StefSchenkelaars
username_0
@username_2 It's probably a good idea to write a new issue for this and include your proposal. Since I think it will get lost since you commented on a closed PR. If I get bored sometimes, I might have a look at this, but you might fix it yourself too ;)
comment