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

Fix ArgumentError message for without method

This commit is contained in:
Martin Jaime 2021-05-22 16:53:53 -03:00
parent 3bd6b688d0
commit 70dec80388
2 changed files with 4 additions and 1 deletions

View file

@ -1162,7 +1162,7 @@ module ActiveRecord
records.compact!
unless records.all?(klass)
raise ArgumentError, "You must only pass a single or collection of #{klass.name} objects to #excluding."
raise ArgumentError, "You must only pass a single or collection of #{klass.name} objects to ##{__callee__}."
end
spawn.excluding!(records)

View file

@ -48,6 +48,9 @@ class ExcludingTest < ActiveRecord::TestCase
def test_raises_on_record_from_different_class
error = assert_raises(ArgumentError) { Post.excluding(@post, comments(:greetings)) }
assert_equal "You must only pass a single or collection of Post objects to #excluding.", error.message
error = assert_raises(ArgumentError) { Post.without(@post, comments(:greetings)) }
assert_equal "You must only pass a single or collection of Post objects to #without.", error.message
end
private