-
-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test matchers for validators #56
Add test matchers for validators #56
Conversation
@StefSchenkelaars 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. |
@igorkasyanchuk Well, I actually build it to work with |
I've tested the matchers with minitest and the shoulda context gem. Everything worked as expected and I've updated the readme accordingly. |
This is fantastic! |
let me know if you think it's ready for a review |
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) |
merged and released a new version. Thank you |
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 |
@connorshea 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 ;) |
I worked on a first version of the test matchers as requested in #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.