support additional arguments to can? which get passed to the block - closes #48

This commit is contained in:
Ryan Bates
2010-04-15 11:21:44 -07:00
parent f027b2ebb3
commit 69f7a65914
3 changed files with 17 additions and 3 deletions

View File

@@ -132,4 +132,12 @@ describe CanCan::Ability do
@ability.clear_aliased_actions
@ability.aliased_actions[:modify].should be_nil
end
it "should pass additional arguments to block from can?" do
@ability.can :read, Integer do |int, x|
int > x
end
@ability.can?(:read, 2, 1).should be_true
@ability.can?(:read, 2, 3).should be_false
end
end