@@ -48,9 +48,9 class QueryTest < ActiveSupport::TestCase | |||
|
48 | 48 | end |
|
49 | 49 | |
|
50 | 50 | def find_issues_with_query(query) |
|
51 | Issue.find :all, | |
|
52 | :include => [ :assigned_to, :status, :tracker, :project, :priority ], | |
|
53 | :conditions => query.statement | |
|
51 | Issue.includes([:assigned_to, :status, :tracker, :project, :priority]).where( | |
|
52 | query.statement | |
|
53 | ).all | |
|
54 | 54 | end |
|
55 | 55 | |
|
56 | 56 | def assert_find_issues_with_query_is_successful(query) |
@@ -619,10 +619,9 class QueryTest < ActiveSupport::TestCase | |||
|
619 | 619 | c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'string' } |
|
620 | 620 | assert c |
|
621 | 621 | assert c.sortable |
|
622 | issues = Issue.find :all, | |
|
623 | :include => [ :assigned_to, :status, :tracker, :project, :priority ], | |
|
624 | :conditions => q.statement, | |
|
625 | :order => "#{c.sortable} ASC" | |
|
622 | issues = Issue.includes([:assigned_to, :status, :tracker, :project, :priority]).where( | |
|
623 | q.statement | |
|
624 | ).order("#{c.sortable} ASC").all | |
|
626 | 625 | values = issues.collect {|i| i.custom_value_for(c.custom_field).to_s} |
|
627 | 626 | assert !values.empty? |
|
628 | 627 | assert_equal values.sort, values |
@@ -633,10 +632,9 class QueryTest < ActiveSupport::TestCase | |||
|
633 | 632 | c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'string' } |
|
634 | 633 | assert c |
|
635 | 634 | assert c.sortable |
|
636 | issues = Issue.find :all, | |
|
637 | :include => [ :assigned_to, :status, :tracker, :project, :priority ], | |
|
638 | :conditions => q.statement, | |
|
639 | :order => "#{c.sortable} DESC" | |
|
635 | issues = Issue.includes([:assigned_to, :status, :tracker, :project, :priority]).where( | |
|
636 | q.statement | |
|
637 | ).order("#{c.sortable} DESC").all | |
|
640 | 638 | values = issues.collect {|i| i.custom_value_for(c.custom_field).to_s} |
|
641 | 639 | assert !values.empty? |
|
642 | 640 | assert_equal values.sort.reverse, values |
@@ -647,10 +645,9 class QueryTest < ActiveSupport::TestCase | |||
|
647 | 645 | c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'float' } |
|
648 | 646 | assert c |
|
649 | 647 | assert c.sortable |
|
650 | issues = Issue.find :all, | |
|
651 | :include => [ :assigned_to, :status, :tracker, :project, :priority ], | |
|
652 | :conditions => q.statement, | |
|
653 | :order => "#{c.sortable} ASC" | |
|
648 | issues = Issue.includes([:assigned_to, :status, :tracker, :project, :priority]).where( | |
|
649 | q.statement | |
|
650 | ).order("#{c.sortable} ASC").all | |
|
654 | 651 | values = issues.collect {|i| begin; Kernel.Float(i.custom_value_for(c.custom_field).to_s); rescue; nil; end}.compact |
|
655 | 652 | assert !values.empty? |
|
656 | 653 | assert_equal values.sort, values |
General Comments 0
You need to be logged in to leave comments.
Login now