Skip to content

Commit

Permalink
Add test for slug to ID with ID is out of range
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eileencodes committed May 1, 2020
1 parent b55b4e2 commit b74256b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions activerecord/test/cases/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ def test_find_by_slug
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
Expand Down

0 comments on commit b74256b

Please sign in to comment.