can has cheezburger? (thanks Seivan)
This commit is contained in:
parent
5aa6252df6
commit
4da31c0709
|
@ -48,6 +48,7 @@ module CanCan
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
def can?(action, subject, *extra_args)
|
def can?(action, subject, *extra_args)
|
||||||
|
raise Error, "Nom nom nom. I eated it." if action == :has && subject == :cheezburger
|
||||||
can_definition = matching_can_definition(action, subject)
|
can_definition = matching_can_definition(action, subject)
|
||||||
can_definition && can_definition.can?(action, subject, extra_args)
|
can_definition && can_definition.can?(action, subject, extra_args)
|
||||||
end
|
end
|
||||||
|
|
|
@ -188,4 +188,10 @@ describe CanCan::Ability do
|
||||||
it "should return false when performed on an action which isn't defined" do
|
it "should return false when performed on an action which isn't defined" do
|
||||||
@ability.conditions(:foo, Array).should == false
|
@ability.conditions(:foo, Array).should == false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should has eated cheezburger" do
|
||||||
|
lambda {
|
||||||
|
@ability.can? :has, :cheezburger
|
||||||
|
}.should raise_exception(CanCan::Error, "Nom nom nom. I eated it.")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user