-
Notifications
You must be signed in to change notification settings - Fork 22
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
feature request: Add matcher for raise_not_authorized #39
Comments
We were looking at treating exceptions as a bug fix for the existing permit/forbid matchers: #16 Perhaps we can simply update |
How should that work? Something like Alternatively, #16 seems reasonable - to have one matcher for "Nope", NotAuthorizedError or otherwise. Maybe another matcher for For me, a separate |
I'm in favour of a solution where the tests are concerned with whether the action is permitted/forbidden rather than how the action is permitted or forbidden. The question of whether it was an exception that denied the action feels like an implementation detail rather than something that would be useful to test explicitly. That said, there are concerns about backward compatibility. This could justify a major version release. |
@chrisalley , that is certainly a valid way of looking at it. For the application where this came up for me, I handled forbidden and Anyway, your call and I appreciate all you have done and are doing on this project! |
How about an API where the differing ways of being unauthorised are additional matchers, while
|
One pattern for Pundit with closed systems is to throw a
Pundit::NotAuthorizedError
on initialize when the user is nil. It would be nice to test this using the lovely pundit-matchers type syntax:I am happy to send a pr.
The text was updated successfully, but these errors were encountered: