Skip to content

Commit 93be5e4

Browse files
committed
Rails 7.1 seems to wrap the error
1 parent 0f91284 commit 93be5e4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/integration/mysql_integration_test.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ class AfterPersistedTest < MySQLIntegrationTest
106106
end
107107

108108
test "can't be used to inject SQL using .where" do
109-
assert_raises MySQLBinUUID::InvalidUUID do
109+
# In Rails 7.1, the gets wrapped in an ActiveRecord::StatementInvalid.
110+
expected_error = ActiveRecord.version.to_s.start_with?("7.1") ? ActiveRecord::StatementInvalid : MySQLBinUUID::InvalidUUID
111+
assert_raises(expected_error) do
110112
MyUuidModel.where(the_uuid: "' OR ''='").first
111113
end
112114
end

0 commit comments

Comments
 (0)