1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #36520 from kamipo/test_case_for_deterministic_order

Add test cases to ensure deterministic order for ordinal methods
This commit is contained in:
Ryuta Kamizono 2019-06-20 18:07:40 +09:00 committed by GitHub
commit e14f3f3c11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -517,6 +517,7 @@ class FinderTest < ActiveRecord::TestCase
expected.touch # PostgreSQL changes the default order if no order clause is used
assert_equal expected, Topic.first
assert_equal expected, Topic.limit(5).first
assert_equal expected, Topic.order(nil).first
end
def test_model_class_responds_to_first_bang
@ -540,6 +541,7 @@ class FinderTest < ActiveRecord::TestCase
expected.touch # PostgreSQL changes the default order if no order clause is used
assert_equal expected, Topic.second
assert_equal expected, Topic.limit(5).second
assert_equal expected, Topic.order(nil).second
end
def test_model_class_responds_to_second_bang
@ -563,6 +565,7 @@ class FinderTest < ActiveRecord::TestCase
expected.touch # PostgreSQL changes the default order if no order clause is used
assert_equal expected, Topic.third
assert_equal expected, Topic.limit(5).third
assert_equal expected, Topic.order(nil).third
end
def test_model_class_responds_to_third_bang
@ -586,6 +589,7 @@ class FinderTest < ActiveRecord::TestCase
expected.touch # PostgreSQL changes the default order if no order clause is used
assert_equal expected, Topic.fourth
assert_equal expected, Topic.limit(5).fourth
assert_equal expected, Topic.order(nil).fourth
end
def test_model_class_responds_to_fourth_bang
@ -609,6 +613,7 @@ class FinderTest < ActiveRecord::TestCase
expected.touch # PostgreSQL changes the default order if no order clause is used
assert_equal expected, Topic.fifth
assert_equal expected, Topic.limit(5).fifth
assert_equal expected, Topic.order(nil).fifth
end
def test_model_class_responds_to_fifth_bang
@ -777,6 +782,7 @@ class FinderTest < ActiveRecord::TestCase
assert_equal expected, clients.first(2)
assert_equal expected, clients.limit(5).first(2)
assert_equal expected, clients.order(nil).first(2)
end
def test_implicit_order_column_is_configurable