fixing specs due to joins method check in active record additions
This commit is contained in:
parent
9a7c427373
commit
ebf77ed647
|
@ -10,12 +10,14 @@ describe CanCan::ActiveRecordAdditions do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should call where('true=false') when no ability is defined so no records are found" do
|
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 }
|
stub(@model_class).where('true=false').stub!.joins(nil) { :no_match }
|
||||||
@model_class.accessible_by(@ability, :read).should == :no_match
|
@model_class.accessible_by(@ability, :read).should == :no_match
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should call where with matching ability conditions" do
|
it "should call where with matching ability conditions" do
|
||||||
@ability.can :read, @model_class, :foo => {:bar => 1}
|
@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 }
|
stub(@model_class).where(:foos => { :bar => 1 }).stub!.joins([:foo]) { :found_records }
|
||||||
@model_class.accessible_by(@ability, :read).should == :found_records
|
@model_class.accessible_by(@ability, :read).should == :found_records
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user