This project is archived and is in readonly mode.
Patch to adapter_test cases so that the tests work for all adapters
Reported by rwc9u | January 14th, 2009 @ 06:37 AM | in 2.x
The following two tests assert that the database adapter returns the appropriate limit and offset sql; however, limit and offset are not supported in Oracle, so the tests currently fail for the Oracle adapter (the oracle adapters handle this by making the sql query a subselect and using oracles rownums in the outer select).
- test_add_limit_offset_should_sanitize_sql_injection_for_limit_without_comas
- test_add_limit_offset_should_sanitize_sql_injection_for_limit_with_comas
Instead of adding another conditional check of the current adapter under test my patch changes the asserts to check that the sql injection is not present in the resulting limit/offset sql. This changes the tests to be adapter agnostic.
I have tested these changes with the following adapters: MySQL, Postgres, SQLite3, and OracleEnhanced.
Comments and changes to this ticket
-
Ryan McGeary January 24th, 2009 @ 10:50 PM
+1, but Oracle still sucks :-)
I think this patch actually improves the readability of the tests too, because it now asserts the intention of avoiding the sql injection as opposed to checking the expected output.
-
Raimonds Simanovskis March 15th, 2009 @ 08:52 PM
- Tag changed from activerecord, oracle, tests to activerecord, oracle, tests, verified
+1 Oracle enhanced adapter tests pass
-
Pratik August 9th, 2009 @ 10:33 PM
- State changed from new to duplicate
This has been fixed in master already.
Thanks.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>