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.

ActiveRecord tests with the same name

#2774

Hey,

I was mucking about in activerecord/test/cases/finder_test.rb ... about to write a new test, but I came across a bunch of tests with the same name / similar functionality.

For example, lines 158 - 185 have a bunch of finder tests beginning with "test_find_all_with_limit" but this same test is repeated on line 945 and the same functionality tested twice.

It's trivial, but should these repeated tests be removed? I've created the tiny patch here.

Paul

Reported by Paul Campbell · June 7th, 2009 @ 09:59 AM

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

Activity

  1. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from 2-3-stable, patch to 2-3-stable, bugmash, patch

    August 7th, 2009 @ 01:54 PM

  2. Josh Sharpe
    Josh Sharpe

    Verified that there are duplicate tests going on here -- but I would take this patch a but further:

    August 8th, 2009 @ 02:15 AM

  3. Josh Sharpe
    Josh Sharpe

    --test_find_all_with_limit Was previously testing :order clause when it shouldn't be

    --test_find_all_with_prepared_limit_and_offset Having specifically 3 Entrant fixtures is a requirement for this test, in the event someone adds a fourth down the road, this failing test will be a bit more obvious.

    --test_find_all_with_limit_and_offset_and_multiple_order_clauses I prefer the test that I kept here since it explicitly uses the IDs of the fixtures in the expected order.

    August 8th, 2009 @ 02:20 AM

  4. Repository
    Repository
    • State changed from new to committed

    (from [9aaeb18781f329bf04c3174898bb8f32581a515e]) Tidy up the AR tests, removing duplicates and making tests clearer / more focussed.

    Signed-off-by: Michael Koziarski michael@koziarski.com

    [#2774 ActiveRecord tests with the same name state:committed] http://github.com/rails/rails/commit/9aaeb18781f329bf04c3174898bb8f...

    August 8th, 2009 @ 03:57 AM

  5. Repository
    Repository

    (from [54e7f5ba435b7573c68c7acd65c9d2537427de7e]) Tidy up the AR tests, removing duplicates and making tests clearer / more focussed.

    Signed-off-by: Michael Koziarski michael@koziarski.com

    [#2774 ActiveRecord tests with the same name state:committed] http://github.com/rails/rails/commit/54e7f5ba435b7573c68c7acd65c9d2...

    August 8th, 2009 @ 03:57 AM

  6. Michael Koziarski
    Michael Koziarski
    • Tag changed from 2-3-stable, bugmash, patch to 2-3-stable, patch

    August 8th, 2009 @ 04:00 AM