-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for view-level
policy_scope
See 87d859a and #207. Effectively `policy_scope` in the view should not make the controller consider itself as scoped.
- Loading branch information
1 parent
0b9b3a6
commit e3579f6
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe Pundit::Helper do | ||
let(:user) { double } | ||
let(:controller) { Controller.new(user, "update", double) } | ||
let(:view) { Controller::View.new(controller) } | ||
|
||
describe "#policy_scope" do | ||
it "doesn't flip pundit_policy_scoped?" do | ||
scoped = view.policy_scope(Post) | ||
|
||
expect(scoped).to be(Post.published) | ||
expect(controller).not_to be_pundit_policy_scoped | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters