diff --git a/lib/cancan/ability.rb b/lib/cancan/ability.rb index b2fbcf9..d173c65 100644 --- a/lib/cancan/ability.rb +++ b/lib/cancan/ability.rb @@ -48,6 +48,7 @@ module CanCan # end # 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 && can_definition.can?(action, subject, extra_args) end diff --git a/spec/cancan/ability_spec.rb b/spec/cancan/ability_spec.rb index c51b22b..4aaa3ba 100644 --- a/spec/cancan/ability_spec.rb +++ b/spec/cancan/ability_spec.rb @@ -188,4 +188,10 @@ describe CanCan::Ability do it "should return false when performed on an action which isn't defined" do @ability.conditions(:foo, Array).should == false 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