Fix accessible_by for Mongoid documents when no ability is defined.
The previous spec that checked for this was not right, since there were no documents in the collection, so every query would return an empty result.
This commit is contained in:
@@ -51,6 +51,10 @@ describe CanCan::MongoidAdditions do
|
||||
end
|
||||
|
||||
it "should return [] when no ability is defined so no records are found" do
|
||||
@model_class.create :title => 'Sir'
|
||||
@model_class.create :title => 'Lord'
|
||||
@model_class.create :title => 'Dude'
|
||||
|
||||
@model_class.accessible_by(@ability, :read).should == []
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user