Skip to content

Commit 603ee3b

Browse files
committed
reimplement test using sql server limits
1 parent 62d0414 commit 603ee3b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/cases/coerced_tests.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,3 +2155,15 @@ def test_insert_all_returns_requested_sql_fields_coerced
21552155
assert_equal %w[ REWORK ], result.pluck("name")
21562156
end
21572157
end
2158+
2159+
class ActiveRecord::Encryption::EncryptableRecordTest < ActiveRecord::EncryptionTestCase
2160+
# TODO: Remove coerce after Rails 7.1.0 (see https://github.com/rails/rails/pull/44052)
2161+
# Same as original but SQL Server string is varchar(4000), not varchar(255) as other adapters. Produce invalid strings with 4001 characters
2162+
coerce_tests! %r{validate column sizes}
2163+
test "validate column sizes coerced" do
2164+
assert EncryptedAuthor.new(name: "jorge").valid?
2165+
assert_not EncryptedAuthor.new(name: "a" * 4001).valid?
2166+
author = EncryptedAuthor.create(name: "a" * 4001)
2167+
assert_not author.valid?
2168+
end
2169+
end

0 commit comments

Comments
 (0)