don't stop at cannot definition when checking class - closes #131
This commit is contained in:
parent
4fe44af45d
commit
5a353c1cba
|
@ -30,7 +30,7 @@ module CanCan
|
||||||
elsif @conditions.kind_of?(Hash) && subject.class != Class
|
elsif @conditions.kind_of?(Hash) && subject.class != Class
|
||||||
matches_conditions_hash?(subject)
|
matches_conditions_hash?(subject)
|
||||||
else
|
else
|
||||||
true
|
@base_behavior
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,14 @@ describe CanCan::Ability do
|
||||||
@ability.can?(:read, [[4, 5, 6]]).should be_false
|
@ability.can?(:read, [[4, 5, 6]]).should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should not stop at cannot definition when comparing class" do
|
||||||
|
@ability.can :read, Array
|
||||||
|
@ability.cannot :read, Array, :first => 1
|
||||||
|
@ability.can?(:read, [2,3,5]).should be_true
|
||||||
|
@ability.can?(:read, [1,3,5]).should be_false
|
||||||
|
@ability.can?(:read, Array).should be_true
|
||||||
|
end
|
||||||
|
|
||||||
it "should has eated cheezburger" do
|
it "should has eated cheezburger" do
|
||||||
lambda {
|
lambda {
|
||||||
@ability.can? :has, :cheezburger
|
@ability.can? :has, :cheezburger
|
||||||
|
|
Loading…
Reference in New Issue
Block a user