summaryrefslogtreecommitdiffstats
path: root/test/unit/query_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-06-23 05:19:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-06-23 05:19:07 +0000
commitd8a202471586677cf1863de390389058b1f0a0c0 (patch)
treef6073dbcea4bcfd82ace98f92b2a9bb6a73a2e82 /test/unit/query_test.rb
parentce1c65225037622c10568b3e6955cecce7e80fd9 (diff)
downloadredmine-d8a202471586677cf1863de390389058b1f0a0c0.tar.gz
redmine-d8a202471586677cf1863de390389058b1f0a0c0.zip
Dangerous query method deprecation warnings (#23630).
git-svn-id: http://svn.redmine.org/redmine/trunk@17411 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r--test/unit/query_test.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index dd5ef3629..5b9886dd9 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -1483,7 +1483,8 @@ class QueryTest < ActiveSupport::TestCase
c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'string' }
assert c
assert c.sortable
- issues = q.issues(:order => "#{c.sortable} ASC")
+ q.sort_criteria = [[c.name.to_s, 'asc']]
+ issues = q.issues
values = issues.collect {|i| i.custom_value_for(c.custom_field).to_s}
assert !values.empty?
assert_equal values.sort, values
@@ -1494,7 +1495,8 @@ class QueryTest < ActiveSupport::TestCase
c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'string' }
assert c
assert c.sortable
- issues = q.issues(:order => "#{c.sortable} DESC")
+ q.sort_criteria = [[c.name.to_s, 'desc']]
+ issues = q.issues
values = issues.collect {|i| i.custom_value_for(c.custom_field).to_s}
assert !values.empty?
assert_equal values.sort.reverse, values
@@ -1505,7 +1507,8 @@ class QueryTest < ActiveSupport::TestCase
c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'float' }
assert c
assert c.sortable
- issues = q.issues(:order => "#{c.sortable} ASC")
+ q.sort_criteria = [[c.name.to_s, 'asc']]
+ issues = q.issues
values = issues.collect {|i| begin; Kernel.Float(i.custom_value_for(c.custom_field).to_s); rescue; nil; end}.compact
assert !values.empty?
assert_equal values.sort, values
@@ -1703,9 +1706,9 @@ class QueryTest < ActiveSupport::TestCase
def test_issue_ids
q = IssueQuery.new(:name => '_')
- order = "issues.subject, issues.id"
- issues = q.issues(:order => order)
- assert_equal issues.map(&:id), q.issue_ids(:order => order)
+ q.sort_criteria = ['subject', 'id']
+ issues = q.issues
+ assert_equal issues.map(&:id), q.issue_ids
end
def test_label_for