Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Patch to adapter_test cases so that the tests work for all adapters

#1758

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.

Reported by rwc9u · January 14th, 2009 @ 06:37 AM

State: duplicate
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Pat George
  2. Christopher Murphy
  3. Ryan McGeary
    Ryan McGeary

    +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.

    January 24th, 2009 @ 10:50 PM

  4. Raimonds Simanovskis
    Raimonds Simanovskis
    • Tag changed from activerecord, oracle, tests to activerecord, oracle, tests, verified

    +1 Oracle enhanced adapter tests pass

    March 15th, 2009 @ 08:52 PM

  5. Pratik
    Pratik
    • State changed from new to duplicate

    This has been fixed in master already.

    Thanks.

    August 9th, 2009 @ 10:33 PM