Skip to content
Snippets Groups Projects
Commit 75eb1917 authored by Yura Sokolov's avatar Yura Sokolov
Browse files

add test for single `cannot` definition

parent 5fd79309
No related branches found
No related tags found
No related merge requests found
......@@ -148,6 +148,16 @@ describe CanCan::Ability do
end
it "should always return `false` for single cannot definition" do
@ability.cannot :read, Integer do |int|
int > 10 ? nil : ( int > 5 )
end
@ability.can?(:read, "foo").should be_false
@ability.can?(:read, 3).should be_false
@ability.can?(:read, 8).should be_false
@ability.can?(:read, 123).should be_false
end
it "should pass to previous cannot definition, if block returns false or nil" do
@ability.cannot :read, :all
@ability.can :read, Integer do |int|
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment