summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-04 10:04:25 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-04 10:04:25 +0000
commita8083fb9a81d442be19cf3b528f2e4bc5bfe1ba5 (patch)
treed2e20418b4b487ff973a67e89e4bf9c274aaf4e0 /test
parent0337d9abc3590de73b1c13c932de82afd314709a (diff)
downloadredmine-a8083fb9a81d442be19cf3b528f2e4bc5bfe1ba5.tar.gz
redmine-a8083fb9a81d442be19cf3b528f2e4bc5bfe1ba5.zip
Pass the order option as an array to satisfy sqlserver adapter (#12713).
Unlike other adapters, the sqlserver adapter processes the order option and wipes it when using functions. Here we can see a "ASC" inserted in the COALESCE call: irb(main):001:0> Issue.order("coalesce(estimated_hours, 0), id").to_sql => "SELECT [issues].* FROM [issues] ORDER BY coalesce(estimated_hours ASC, 0) ASC, id ASC" This does not happen when passing the order SQL fragments separately. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11115 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/helpers/sort_helper_test.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/unit/helpers/sort_helper_test.rb b/test/unit/helpers/sort_helper_test.rb
index 551de8762..4ec2d451b 100644
--- a/test/unit/helpers/sort_helper_test.rb
+++ b/test/unit/helpers/sort_helper_test.rb
@@ -30,21 +30,21 @@ class SortHelperTest < ActionView::TestCase
sort_init 'attr1', 'desc'
sort_update(['attr1', 'attr2'])
- assert_equal 'attr1 DESC', sort_clause
+ assert_equal ['attr1 DESC'], sort_clause
end
def test_default_sort_clause_with_hash
sort_init 'attr1', 'desc'
sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'})
- assert_equal 'table1.attr1 DESC', sort_clause
+ assert_equal ['table1.attr1 DESC'], sort_clause
end
def test_default_sort_clause_with_multiple_columns
sort_init 'attr1', 'desc'
sort_update({'attr1' => ['table1.attr1', 'table1.attr2'], 'attr2' => 'table2.attr2'})
- assert_equal 'table1.attr1 DESC, table1.attr2 DESC', sort_clause
+ assert_equal ['table1.attr1 DESC', 'table1.attr2 DESC'], sort_clause
end
def test_params_sort
@@ -53,7 +53,7 @@ class SortHelperTest < ActionView::TestCase
sort_init 'attr1', 'desc'
sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'})
- assert_equal 'table1.attr1, table2.attr2 DESC', sort_clause
+ assert_equal ['table1.attr1', 'table2.attr2 DESC'], sort_clause
assert_equal 'attr1,attr2:desc', @session['foo_bar_sort']
end
@@ -63,7 +63,7 @@ class SortHelperTest < ActionView::TestCase
sort_init 'attr1', 'desc'
sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'})
- assert_equal 'table1.attr1 DESC', sort_clause
+ assert_equal ['table1.attr1 DESC'], sort_clause
assert_equal 'attr1:desc', @session['foo_bar_sort']
end
@@ -73,7 +73,7 @@ class SortHelperTest < ActionView::TestCase
sort_init 'attr1', 'desc'
sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'})
- assert_equal 'table1.attr1, table2.attr2', sort_clause
+ assert_equal ['table1.attr1', 'table2.attr2'], sort_clause
assert_equal 'attr1,attr2', @session['foo_bar_sort']
end