fixing specs due to joins method check in active record additions

This commit is contained in:
Ryan Bates 2010-11-12 10:31:36 -08:00
parent 9a7c427373
commit ebf77ed647

View File

@ -10,12 +10,14 @@ describe CanCan::ActiveRecordAdditions do
end
it "should call where('true=false') when no ability is defined so no records are found" do
stub(@model_class).joins { true } # just so it responds to .joins as well
stub(@model_class).where('true=false').stub!.joins(nil) { :no_match }
@model_class.accessible_by(@ability, :read).should == :no_match
end
it "should call where with matching ability conditions" do
@ability.can :read, @model_class, :foo => {:bar => 1}
stub(@model_class).joins { true } # just so it responds to .joins as well
stub(@model_class).where(:foos => { :bar => 1 }).stub!.joins([:foo]) { :found_records }
@model_class.accessible_by(@ability, :read).should == :found_records
end