mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Policy namespacing: Add spec ensuring fallback on non-namespaced policy class
This commit is contained in:
parent
7ebc33e112
commit
edf0e6ef76
1 changed files with 4 additions and 0 deletions
|
@ -201,6 +201,10 @@ describe Pundit do
|
||||||
expect(nested_controller.policy(comment).class).to eq Admin::CommentPolicy
|
expect(nested_controller.policy(comment).class).to eq Admin::CommentPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "falls back to the non-namespaced policy class if there isn't a namespaced one" do
|
||||||
|
expect(nested_controller.policy(post).class).to eq PostPolicy
|
||||||
|
end
|
||||||
|
|
||||||
it "allows policy to be injected" do
|
it "allows policy to be injected" do
|
||||||
new_policy = OpenStruct.new
|
new_policy = OpenStruct.new
|
||||||
controller.policy = new_policy
|
controller.policy = new_policy
|
||||||
|
|
Loading…
Reference in a new issue