File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class Sort < Node
88
99 class << self
1010 def extract ( context , str )
11- return unless str
11+ return if str . blank?
1212 attr , direction = str . split ( /\s +/ , 2 )
1313 self . new ( context ) . build ( name : attr , dir : direction )
1414 end
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ def sorts=(args)
6969 else
7070 sort = Nodes ::Sort . extract ( @context , sort )
7171 end
72- self . sorts << sort
72+ self . sorts << sort if sort
7373 end
7474 when Hash
7575 args . each do |index , attrs |
Original file line number Diff line number Diff line change @@ -479,6 +479,11 @@ def remove_quotes_and_backticks(str)
479479 @s = Search . new ( Person )
480480 end
481481
482+ it 'doesn\'t creates sorts' do
483+ @s . sorts = ''
484+ expect ( @s . sorts . size ) . to eq ( 0 )
485+ end
486+
482487 it 'creates sorts based on a single attribute/direction' do
483488 @s . sorts = 'id desc'
484489 expect ( @s . sorts . size ) . to eq ( 1 )
You can’t perform that action at this time.
0 commit comments