removing need to pass tableize option around for query conditions
This commit is contained in:
@@ -34,7 +34,7 @@ describe CanCan::CanDefinition do
|
||||
it "should return table names in conditions for association joins" do
|
||||
@conditions[:foo] = {:bar => 1}
|
||||
@conditions[:test] = 1
|
||||
@can.conditions(:tableize => true).should == { :foos => { :bar => 1}, :test => 1 }
|
||||
@can.tableized_conditions.should == { :foos => { :bar => 1}, :test => 1 }
|
||||
end
|
||||
|
||||
it "should return no association joins if conditions is nil" do
|
||||
|
||||
@@ -84,19 +84,4 @@ describe CanCan::Query do
|
||||
@ability.query(:manage, Person).sql_conditions.should == {:id=>1}
|
||||
@ability.query(:read, Person).sql_conditions.should == 'true=true'
|
||||
end
|
||||
|
||||
it "should accept array condition for use in sql" do
|
||||
@ability.can :read, Person, ["user_id = ?", 1]
|
||||
|
||||
@ability.query(:read, Person).sql_conditions.should == ['user_id = ?', 1]
|
||||
@ability.query(:read, Person).association_joins.should be_nil
|
||||
end
|
||||
|
||||
it "should accept array condition for use in sql and do sanitizing in complex conditions" do
|
||||
@ability.cannot :read, Person
|
||||
@ability.can :read, Person, ["user_id = ?", 1]
|
||||
|
||||
@ability.query(:read, Person).sql_conditions.should == 'user_id = 1'
|
||||
@ability.query(:read, Person).association_joins.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user