@@ -575,9 +575,47 @@ def build_statement(type, value, operator)
575575 end
576576 end
577577
578- it 'supports uuid type query' do
579- uuid = SecureRandom . uuid
580- expect ( build_statement ( :uuid , uuid , nil ) ) . to eq ( [ '(field = ?)' , uuid ] )
578+ describe 'uuid type queries' do
579+ it 'supports uuid type query' do
580+ uuid = SecureRandom . uuid
581+ expect ( build_statement ( :uuid , uuid , nil ) ) . to eq ( [ '(field = ?)' , uuid ] )
582+ end
583+
584+ it "supports '_blank' operator" do
585+ [ [ '_blank' , '' ] , [ '' , '_blank' ] ] . each do |value , operator |
586+ expect ( build_statement ( :uuid , value , operator ) ) . to eq ( [ '(field IS NULL)' ] )
587+ end
588+ end
589+
590+ it "supports '_present' operator" do
591+ [ [ '_present' , '' ] , [ '' , '_present' ] ] . each do |value , operator |
592+ expect ( build_statement ( :uuid , value , operator ) ) . to eq ( [ '(field IS NOT NULL)' ] )
593+ end
594+ end
595+
596+ it "supports '_null' operator" do
597+ [ [ '_null' , '' ] , [ '' , '_null' ] ] . each do |value , operator |
598+ expect ( build_statement ( :uuid , value , operator ) ) . to eq ( [ '(field IS NULL)' ] )
599+ end
600+ end
601+
602+ it "supports '_not_null' operator" do
603+ [ [ '_not_null' , '' ] , [ '' , '_not_null' ] ] . each do |value , operator |
604+ expect ( build_statement ( :uuid , value , operator ) ) . to eq ( [ '(field IS NOT NULL)' ] )
605+ end
606+ end
607+
608+ it "supports '_empty' operator" do
609+ [ [ '_empty' , '' ] , [ '' , '_empty' ] ] . each do |value , operator |
610+ expect ( build_statement ( :uuid , value , operator ) ) . to eq ( [ '(field IS NULL)' ] )
611+ end
612+ end
613+
614+ it "supports '_not_empty' operator" do
615+ [ [ '_not_empty' , '' ] , [ '' , '_not_empty' ] ] . each do |value , operator |
616+ expect ( build_statement ( :uuid , value , operator ) ) . to eq ( [ '(field IS NOT NULL)' ] )
617+ end
618+ end
581619 end
582620 end
583621
0 commit comments