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

Add test case for unscope with unknown column

This commit is contained in:
Ryuta Kamizono 2019-02-24 08:23:43 +09:00
parent df2765ac03
commit 15da1fb35b

View file

@ -1941,6 +1941,17 @@ class RelationTest < ActiveRecord::TestCase
assert_equal p2.first.comments, comments
end
def test_unscope_with_unknown_column
comment = comments(:greetings)
comment.update!(comments: 1)
comments = Comment.where(comments: 1).unscope(where: :unknown_column)
assert_equal [comment], comments
comments = Comment.where(comments: 1).unscope(where: { comments: :unknown_column })
assert_equal [comment], comments
end
def test_unscope_specific_where_value
posts = Post.where(title: "Welcome to the weblog", body: "Such a lovely day")