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:
parent
55eea50ab5
commit
2cd4cc48d4
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue