Skip to content

Commit

Permalink
Add test for Pundit.authorize
Browse files Browse the repository at this point in the history
  • Loading branch information
pcriv committed Jul 1, 2018
1 parent 55eea50 commit 2cd4cc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/pundit_spec.rb
Expand Up @@ -22,6 +22,10 @@
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)
Expand Down

0 comments on commit 2cd4cc4

Please sign in to comment.