Permalink
Browse files

add specs to sql conditions by not Hash

  • Loading branch information...
1 parent ff9a917 commit 7e0e72276ee5737dda309a367dcfb64c26f7cc97 @funny-falcon funny-falcon committed with Sep 13, 2010
Showing with 8 additions and 0 deletions.
  1. +8 −0 spec/cancan/active_record_additions_spec.rb
@@ -48,4 +48,12 @@
# @ability.associations_hash(:read, @model_class).should == [{:too => [:far]}, :foo]
@model_class.accessible_by(@ability).should == :found_records
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

0 comments on commit 7e0e722

Please sign in to comment.