From 2cd4cc48d4a039c8a9eb011bb4ba93d97f209d57 Mon Sep 17 00:00:00 2001 From: Pablo Crivella Date: Sun, 1 Jul 2018 20:05:12 +0200 Subject: [PATCH] Add test for Pundit.authorize --- spec/pundit_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/pundit_spec.rb b/spec/pundit_spec.rb index f38ca8e..6d64054 100644 --- a/spec/pundit_spec.rb +++ b/spec/pundit_spec.rb @@ -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)