varvet / pundit

Minimal authorization through OO design and pure Ruby classes
MIT License
8.24k stars 627 forks source link

rescue-not_authorized_error-on-rspec #672

Closed masarakki closed 8 months ago

masarakki commented 3 years ago

When apply Multiple error messages per one policy action,

it { expect(subject).not_to permit(user, record) } fails because it raise exception. I think this matcher concerns only permit or not, so it should catch Pundit::NotAuthorizedError, and convert true/false.

dgmstuart commented 2 years ago

@masarakki Hi - I think we've either changed or removed the suggestion on how to achieve "multiple" error messages: if I recall correctly it turned out to be quite a problematic approach.

Could you please have a look through the current README and update the PR description accordingly.