Fix mongoid example according to ability precedence. Closes #672
This commit is contained in:
parent
6886aecb9a
commit
17043ca61c
|
@ -83,14 +83,13 @@ if ENV["MODEL_ADAPTER"] == "mongoid"
|
||||||
MongoidProject.accessible_by(@ability, :destroy).entries.should == [sir]
|
MongoidProject.accessible_by(@ability, :destroy).entries.should == [sir]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is able to mix empty conditions and hashes" do
|
it "takes presedence over rule defined without a condition" do
|
||||||
pending "TODO figure out why this isn't working"
|
|
||||||
@ability.can :read, :mongoid_projects
|
@ability.can :read, :mongoid_projects
|
||||||
@ability.can :read, :mongoid_projects, :title => 'Sir'
|
@ability.can :read, :mongoid_projects, :title => 'Sir'
|
||||||
sir = MongoidProject.create(:title => 'Sir')
|
sir = MongoidProject.create(:title => 'Sir')
|
||||||
lord = MongoidProject.create(:title => 'Lord')
|
lord = MongoidProject.create(:title => 'Lord')
|
||||||
|
|
||||||
MongoidProject.accessible_by(@ability, :read).count.should == 2
|
MongoidProject.accessible_by(@ability, :read).entries.should == [sir]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns everything when the defined ability is access all" do
|
it "returns everything when the defined ability is access all" do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user