1
0
Fork 0
mirror of https://github.com/varvet/pundit.git synced 2022-11-09 12:30:11 -05:00

Add test for Pundit.authorize

This commit is contained in:
Pablo Crivella 2018-07-01 20:05:12 +02:00
parent 55eea50ab5
commit 2cd4cc48d4

View file

@ -22,6 +22,10 @@ describe Pundit do
expect(Pundit.authorize(user, post, :update?)).to be_truthy
end
it "can be given a different policy class" do
expect(Pundit.authorize(user, post, :create?, policy_class: PublicationPolicy)).to be_truthy
end
it "works with anonymous class policies" do
expect(Pundit.authorize(user, article_tag, :show?)).to be_truthy
expect { Pundit.authorize(user, article_tag, :destroy?) }.to raise_error(Pundit::NotAuthorizedError)