Add failing example of cannot for attribute, corresponds to #406

This commit is contained in:
Jan Vlnas 2011-09-16 00:21:18 +02:00 committed by Ryan Bates
parent eafd6cfcde
commit aa83fee7a4

View File

@ -338,6 +338,12 @@ describe CanCan::Ability do
@ability.can?(:read, 5..9).should be_false @ability.can?(:read, 5..9).should be_false
end end
it "rejects permission only to a given attribute" do
@ability.can :update, :books
@ability.cannot :update, :books, :author
@ability.can?(:update, :books).should be_true
@ability.can?(:update, :books, :author).should be_false
end
# Hash Association # Hash Association