Skip to content

Commit

Permalink
Rails 7.1 seems to wrap the error
Browse files Browse the repository at this point in the history
  • Loading branch information
markoudev committed Jan 7, 2025
1 parent 0f91284 commit 6e3a7fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/integration/mysql_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class AfterPersistedTest < MySQLIntegrationTest
end

test "can't be used to inject SQL using .where" do
assert_raises MySQLBinUUID::InvalidUUID do
# In Rails 7.1, the gets wrapped in an ActiveRecord::StatementInvalid.
expected_error = ActiveRecord.version.to_s.start_with?("7.1") ? MySQLBinUUID::InvalidUUID : ActiveRecord::StatementInvalid
assert_raises(expected_error) do
MyUuidModel.where(the_uuid: "' OR ''='").first
end
end
Expand Down

0 comments on commit 6e3a7fc

Please sign in to comment.