提交 91276036 编写于 作者: M Miguel Grazziotin

[#20338] adding tests to ensure the order clause takes precedence

上级 24389135
......@@ -58,6 +58,24 @@ def test_find_with_ids_returning_ordered
assert_equal 'The Fourth Topic of the day', records[0].title
assert_equal 'The Second Topic of the day', records[1].title
assert_equal 'The Fifth Topic of the day', records[2].title
records = Topic.find(['4','2','5'])
assert_equal 'The Fourth Topic of the day', records[0].title
assert_equal 'The Second Topic of the day', records[1].title
assert_equal 'The Fifth Topic of the day', records[2].title
records = Topic.find('4','2','5')
assert_equal 'The Fourth Topic of the day', records[0].title
assert_equal 'The Second Topic of the day', records[1].title
assert_equal 'The Fifth Topic of the day', records[2].title
end
def test_find_with_ids_and_order_clause
# The order clause takes precedence over the informed ids
records = Topic.order(:author_name).find([5,3,1])
assert_equal 'The Third Topic of the day', records[0].title
assert_equal 'The First Topic', records[1].title
assert_equal 'The Fifth Topic of the day', records[2].title
end
def test_find_passing_active_record_object_is_deprecated
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册