Would it be possible for us to include something like this gem?
https://github.com/ksimmons/policy-assertions
It would be fantastic if pundit came with test assertions out of the box.
:wave: user for a while of pundit. i can see how some would prefer that approach, to me though policies are pretty straight up ruby objects and adding a DSL on top of rspec/minitest would add more maintenance than benefit to the entire community. I like that there is a side gem that can do what is needed though, maybe mentioning that those exist in the readme would be enough.
@Austio I agree. The gem is quite small, so I don't think maintenance would ever be an issue since as you said, policies are POROs.
I would definitely be for adding it to the readme at least!
I wrote an article about this and in there is a custom matcher for Pundit, maybe its helpful for you.
https://medium.com/@toddbaur/using-devise-and-pundit-with-rails-5-to-delegate-authorization-to-users-22f2c83d0244
I don't think we will add anything for this at the moment. Perhaps we can revisit this in the future.
Most helpful comment
:wave: user for a while of pundit. i can see how some would prefer that approach, to me though policies are pretty straight up ruby objects and adding a DSL on top of rspec/minitest would add more maintenance than benefit to the entire community. I like that there is a side gem that can do what is needed though, maybe mentioning that those exist in the readme would be enough.