aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-11-25 15:33:03 -0500
committerGitHub <noreply@github.com>2017-11-25 15:33:03 -0500
commit89a209f1abba5a2320d31c4898dea150c0abd0c0 (patch)
tree87a52a13f3e6c350801b72509dbbf16cdc81f70e /activerecord/test/cases/finder_test.rb
parent72dec81206a4dfc0f14300fa9d40aea240d5b1da (diff)
parentae032ec38463e923c0556fbdd28b9d9fced18b11 (diff)
downloadrails-89a209f1abba5a2320d31c4898dea150c0abd0c0.tar.gz
rails-89a209f1abba5a2320d31c4898dea150c0abd0c0.tar.bz2
rails-89a209f1abba5a2320d31c4898dea150c0abd0c0.zip
Merge pull request #31184 from TheSmartnik/fix_record_not_found_on_reload
Provide arguments to RecordNotFound
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r--activerecord/test/cases/finder_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index b5c9bdf3a7..93957ff50f 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -120,6 +120,21 @@ class FinderTest < ActiveRecord::TestCase
assert_equal "The Fourth Topic of the day", records[2].title
end
+ def test_find_with_ids_with_no_id_passed
+ exception = assert_raises(ActiveRecord::RecordNotFound) { Topic.find }
+ assert_equal exception.model, "Topic"
+ assert_equal exception.primary_key, "id"
+ end
+
+ def test_find_with_ids_with_id_out_of_range
+ exception = assert_raises(ActiveRecord::RecordNotFound) do
+ Topic.find("9999999999999999999999999999999")
+ end
+
+ assert_equal exception.model, "Topic"
+ assert_equal exception.primary_key, "id"
+ end
+
def test_find_passing_active_record_object_is_not_permitted
assert_raises(ArgumentError) do
Topic.find(Topic.last)