Skip to content

Commit 23aa0a4

Browse files
committed
Fix Basic tests
1 parent 72416d2 commit 23aa0a4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/cases/coerced_tests.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ def test_column_names_are_escaped_coerced
8585
assert_equal '[t]]]', conn.quote_column_name('t]')
8686
end
8787

88-
89-
9088
# Just like PostgreSQLAdapter does.
9189
coerce_tests! :test_respect_internal_encoding
9290

@@ -115,6 +113,16 @@ def test_update_date_time_attributes_with_default_timezone_local
115113
end
116114
end
117115
end
116+
117+
# Need to escape `quoted_id` once it contains brackets
118+
coerce_tests! %r{column names are quoted when using #from clause and model has ignored columns}
119+
test "column names are quoted when using #from clause and model has ignored columns coerced" do
120+
refute_empty Developer.ignored_columns
121+
query = Developer.from("developers").to_sql
122+
quoted_id = "#{Developer.quoted_table_name}.#{Developer.quoted_primary_key}"
123+
124+
assert_match(/SELECT #{Regexp.escape(quoted_id)}.* FROM developers/, query)
125+
end
118126
end
119127

120128

0 commit comments

Comments
 (0)