diff options
-rw-r--r-- | app/models/query.rb | 2 | ||||
-rw-r--r-- | test/unit/query_test.rb | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index 796480f3a..ff07a077e 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -48,7 +48,7 @@ class QueryColumn # Returns true if the column is sortable, otherwise false def sortable? - !@sortable.nil? + @sortable.present? end def sortable diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 597168fb8..6a059ca8e 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -1485,6 +1485,16 @@ class QueryTest < ActiveSupport::TestCase assert !q.sortable_columns['cf_1'] end + def test_sortable_should_return_false_for_multi_custom_field + field = CustomField.find(1) + field.update_attribute :multiple, true + + q = IssueQuery.new + + field_column = q.available_columns.detect {|c| c.name==:cf_1} + assert !field_column.sortable? + end + def test_default_sort q = IssueQuery.new assert_equal [['id', 'desc']], q.sort_criteria |