Skip to content
This repository
Browse code

add specs to sql conditions by not Hash

  • Loading branch information...
commit 7e0e72276ee5737dda309a367dcfb64c26f7cc97 1 parent ff9a917
Sokolov Yura authored September 13, 2010 ryanb committed September 17, 2010
8  spec/cancan/active_record_additions_spec.rb
@@ -48,4 +48,12 @@
48 48
     # @ability.associations_hash(:read, @model_class).should == [{:too => [:far]}, :foo]
49 49
     @model_class.accessible_by(@ability).should == :found_records
50 50
   end
  51
+  
  52
+  it "should allow to define sql conditions by not hash" do
  53
+    @ability.can :read, @model_class, :foo => 1
  54
+    @ability.can :read, @model_class, ['bar = ?', 1]
  55
+    stub(@model_class).scoped( :conditions => '(bar = 1) OR (foo=1)', :joins => nil ) { :found_records }
  56
+    stub(@model_class).scoped{|*args| args.inspect}
  57
+    @model_class.accessible_by(@ability).should == :found_records
  58
+  end
51 59
 end

0 notes on commit 7e0e722

Please sign in to comment.
Something went wrong with that request. Please try again.