allow strings along with symbols in Ability definition and checking

This commit is contained in:
Ryan Bates
2011-03-24 11:52:54 -07:00
parent 7ee942c334
commit a03d35272b
3 changed files with 14 additions and 7 deletions
+7
View File
@@ -35,6 +35,13 @@ describe CanCan::Ability do
@ability.can?(:paint, :cars).should be_false
end
it "allows strings instead of symbols" do
@ability.can "paint", "fences"
@ability.can?("paint", "fences").should be_true
@ability.can "access", "all"
@ability.can?("wax", "cars").should be_true
end
# Aliases
+2 -2
View File
@@ -4,7 +4,7 @@ require "spec_helper"
describe CanCan::Rule do
before(:each) do
@conditions = {}
@rule = CanCan::Rule.new(true, :read, Integer, @conditions, nil)
@rule = CanCan::Rule.new(true, :read, :integers, @conditions, nil)
end
it "should return no association joins if none exist" do
@@ -33,7 +33,7 @@ describe CanCan::Rule do
end
it "should return no association joins if conditions is nil" do
rule = CanCan::Rule.new(true, :read, Integer, nil, nil)
rule = CanCan::Rule.new(true, :read, :integers, nil, nil)
rule.associations_hash.should == {}
end
end