allow strings along with symbols in Ability definition and checking
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user