renaming ActiveRecordAdditions#can method to accessible_by since it flows better and makes more sense

This commit is contained in:
Ryan Bates
2010-04-15 23:54:45 -07:00
parent ef5900c5b1
commit 240c281061
5 changed files with 11 additions and 11 deletions

View File

@@ -11,18 +11,18 @@ describe CanCan::ActiveRecordAdditions do
it "should call where(:id => nil) when no ability is defined so no records are found" do
stub(@model_class).where(:id => nil) { :no_where }
@model_class.can(@ability, :read).should == :no_where
@model_class.accessible_by(@ability, :read).should == :no_where
end
it "should call where with matching ability conditions" do
@ability.can :read, @model_class, :foo => 1
stub(@model_class).where(:foo => 1) { :found_records }
@model_class.can(@ability, :read).should == :found_records
@model_class.accessible_by(@ability, :read).should == :found_records
end
it "should default to :read ability and use scoped when where isn't available" do
@ability.can :read, @model_class, :foo => 1
stub(@model_class).scoped(:conditions => {:foo => 1}) { :found_records }
@model_class.can(@ability).should == :found_records
@model_class.accessible_by(@ability).should == :found_records
end
end