This project is archived and is in readonly mode.

#1599 ✓wontfix
Matt Jones

Rake test task looks at wrong database

Reported by Matt Jones | December 18th, 2008 @ 07:14 PM | in 2.x

The test tasks (test:units, test:functionals, etc.) attempt to access the development DB by default. The problem is in db:test:prepare, which calls db:abort_if_pending_migrations without setting RAILS_ENV.

Is this behavior desired and/or still needed? Typically, I would expect that testing tasks could run without the other databases present...

Comments and changes to this ticket

  • Pratik

    Pratik December 19th, 2008 @ 02:08 PM

    "I would expect that testing tasks could run without the other databases present..."

    Me too.

  • andyjeffries

    andyjeffries February 25th, 2009 @ 01:12 PM

    • Tag changed from 2.2, db, rake, testing to 2.2, db, patch, rake, testing

    I'm very new to Rails development, but I've had a quick play with this locally and it seems as simple as a one-line patch.

    Can someone test it out and let me know if this works.

    Also, I couldn't find any tests for Rake tasks so I'm not aware of where to put a test to prove this works (I'm new to testing Rake tasks).

  • Michael Koziarski

    Michael Koziarski March 2nd, 2009 @ 05:25 AM

    db:test:prepare will copy the values over from development to test after running those migrations though. So if there are pending migrations in development you'll get the wrong behaviour.

  • CancelProfileIsBroken

    CancelProfileIsBroken August 5th, 2009 @ 02:17 PM

    • Tag changed from 2.2, db, patch, rake, testing to 2.2, bugmash, db, patch, rake, testing
  • Nick Quaranto

    Nick Quaranto August 8th, 2009 @ 08:25 PM

    1. This seems like a strange use case, I can see it maybe for CI servers and the like, but it doesn't seem helpful enough for normal development.
  • Nick Quaranto

    Nick Quaranto August 8th, 2009 @ 08:26 PM

    That was a minus 1. Seems like LH likes to eat my formatting.

  • Dan Pickett

    Dan Pickett August 8th, 2009 @ 10:10 PM

    -1 on this as well - I think this is something that we might want to address in 3, but I don't identify it as critical to 2.x - in the use case of CI, I just create the dev database so prepare will run successfully

  • CancelProfileIsBroken

    CancelProfileIsBroken August 10th, 2009 @ 02:54 AM

    • State changed from “new” to “wontfix”
    • Tag changed from 2.2, bugmash, db, patch, rake, testing to 2.2, db, patch, rake, testing

    No one has come up with a good workaround for the issue Koz raised. We can reopen if someone has a brainstorm.

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>

Attachments

Pages