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

Add test for slug to ID with ID is out of range

We were testing the behavior of out of range ID's on where queries but
not when out of range slugs are converted to ID's.
This commit is contained in:
eileencodes 2020-05-01 12:41:33 -04:00
parent b55b4e2edb
commit b74256be5b
No known key found for this signature in database
GPG key ID: BA5C575120BBE8DF

View file

@ -538,6 +538,10 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal Topic.find("1-meowmeow"), Topic.find(1)
end
def test_out_of_range_slugs
assert_equal [Topic.find(1)], Topic.where(id: ["1-meowmeow", "9223372036854775808-hello"])
end
def test_find_by_slug_with_array
assert_equal Topic.find([1, 2]), Topic.find(["1-meowmeow", "2-hello"])
assert_equal "The Second Topic of the day", Topic.find(["2-hello", "1-meowmeow"]).first.title