Merge branch 'optional-associations' of https://github.com/socialcast/cancan into socialcast-optional-associations

This commit is contained in:
Ryan Bates
2011-04-01 15:13:02 -07:00
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -249,6 +249,13 @@ describe CanCan::Ability do
@ability.can?(:read, 1..5).should be_true
@ability.can?(:read, 4..6).should be_false
end
it "should not match subjects return nil for methods that must match nested a nested conditions hash" do
mock(object_with_foo = Object.new).foo { :bar }
@ability.can :read, Array, :first => { :foo => :bar }
@ability.can?(:read, [object_with_foo]).should be_true
@ability.can?(:read, []).should be_false
end
it "should not stop at cannot definition when comparing class" do
@ability.can :read, Range