aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2016-02-22 11:50:03 +0000
committerAndrew White <pixeltrix@users.noreply.github.com>2016-02-22 11:50:03 +0000
commit3591a00ea60b46793b0ccf031948ef0ca0802c23 (patch)
tree18d2f55fa4fd2eaf5a102be1fbeade395155ddca /activerecord
parent7f77238daf661672639cc54b8404cd658dab0398 (diff)
parent25dbfba26343f04f0eb978852ad0dc80a18aedc5 (diff)
downloadrails-3591a00ea60b46793b0ccf031948ef0ca0802c23.tar.gz
rails-3591a00ea60b46793b0ccf031948ef0ca0802c23.tar.bz2
rails-3591a00ea60b46793b0ccf031948ef0ca0802c23.zip
Merge pull request #23751 from chezou/add-test-case-order-by-field
Add test cases about MySQL ORDER BY FIELD()
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/relations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 4c15ab6644..95e4230a58 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -358,6 +358,12 @@ class RelationTest < ActiveRecord::TestCase
def test_finding_with_sanitized_order
query = Tag.order(["field(id, ?)", [1,3,2]]).to_sql
assert_match(/field\(id, 1,3,2\)/, query)
+
+ query = Tag.order(["field(id, ?)", []]).to_sql
+ assert_match(/field\(id, NULL\)/, query)
+
+ query = Tag.order(["field(id, ?)", nil]).to_sql
+ assert_match(/field\(id, NULL\)/, query)
end
def test_finding_with_order_limit_and_offset