aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2018-11-27 08:19:50 -0500
committerGitHub <noreply@github.com>2018-11-27 08:19:50 -0500
commitb9c7305dbe57931a153a540d49ae5d469af61a14 (patch)
treef0b9267ab5ea219a043c5de8da5caf5f97648d91 /activerecord/test/cases/finder_test.rb
parentb566be2349053198604e683e6276222ac9b16ed6 (diff)
parent3b9982a3b778b63488975eb03592d33aa9fb04dd (diff)
downloadrails-b9c7305dbe57931a153a540d49ae5d469af61a14.tar.gz
rails-b9c7305dbe57931a153a540d49ae5d469af61a14.tar.bz2
rails-b9c7305dbe57931a153a540d49ae5d469af61a14.zip
Merge pull request #34480 from tekin/configurable-implicit-ordering-column
Make it possible to override the implicit order column
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r--activerecord/test/cases/finder_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index 52fd9291b2..21e84d850b 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -741,6 +741,16 @@ class FinderTest < ActiveRecord::TestCase
assert_equal expected, clients.limit(5).first(2)
end
+ def test_implicit_order_column_is_configurable
+ old_implicit_order_column = Topic.implicit_order_column
+ Topic.implicit_order_column = "title"
+
+ assert_equal topics(:fifth), Topic.first
+ assert_equal topics(:third), Topic.last
+ ensure
+ Topic.implicit_order_column = old_implicit_order_column
+ end
+
def test_take_and_first_and_last_with_integer_should_return_an_array
assert_kind_of Array, Topic.take(5)
assert_kind_of Array, Topic.first(5)