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

Add test for inspecting a Relation with a virtual field

This commit is contained in:
Stephen Margheim 2022-03-10 11:35:51 +01:00 committed by GitHub
parent 9ff8a9fa49
commit 3c02ef95e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,6 +50,11 @@ class CoreTest < ActiveRecord::TestCase
assert_equal "NonExistentTable(Table doesn't exist)", NonExistentTable.inspect
end
def test_inspect_relation_with_virtual_field
relation = Topic.limit(1).select("1 as virtual_field")
assert_match(/virtual_field: 1/, relation.inspect)
end
def test_pretty_print_new
topic = Topic.new
actual = +""