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
1 changed files with 5 additions and 0 deletions

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 = +""