add specs to sql conditions by not Hash
This commit is contained in:
parent
ff9a91705b
commit
7e0e72276e
|
@ -48,4 +48,12 @@ describe CanCan::ActiveRecordAdditions do
|
||||||
# @ability.associations_hash(:read, @model_class).should == [{:too => [:far]}, :foo]
|
# @ability.associations_hash(:read, @model_class).should == [{:too => [:far]}, :foo]
|
||||||
@model_class.accessible_by(@ability).should == :found_records
|
@model_class.accessible_by(@ability).should == :found_records
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should allow to define sql conditions by not hash" do
|
||||||
|
@ability.can :read, @model_class, :foo => 1
|
||||||
|
@ability.can :read, @model_class, ['bar = ?', 1]
|
||||||
|
stub(@model_class).scoped( :conditions => '(bar = 1) OR (foo=1)', :joins => nil ) { :found_records }
|
||||||
|
stub(@model_class).scoped{|*args| args.inspect}
|
||||||
|
@model_class.accessible_by(@ability).should == :found_records
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user