#213 ✓resolved
Martin Kihlgren

[patch] The do_postgres_spec requires a prepared database

Reported by Martin Kihlgren | April 16th, 2008 @ 09:59 AM

This is not a huge problem, of course, since if you have to do a

createdb do_test

you can just as well do some


as well.

But this patch makes the test create the table, so this extra effort isn't even needed!


Comments and changes to this ticket

  • Martin Kihlgren

    Martin Kihlgren April 16th, 2008 @ 10:02 AM

    There are probably slightly prettier ways of doing this - like, destroying and creating the table outside of an actual test.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) April 17th, 2008 @ 01:47 AM

    • State changed from “new” to “open”
    • Milestone cleared.

    This spec relies on the ordering of specs so later specs depend on earlier specs running. This will cause lots of small problems, but the easiest one to demonstrate is autotest -- if one of the specs fails, autotest will keep running the failing spec until it passes. If the failing spec depends on something else running first to create a very specific state, it will likely break when run more than one time.

    The general rule is that you can't depend on specs running in a specific order, and you can't depend on specs running just once. Use the before :all and before methods to setup the environment, and write each spec (it block) stand-alone, independent of anything else.

  • Martin Kihlgren

    Martin Kihlgren April 17th, 2008 @ 02:32 AM

    Yes, the fact that the spec relies on ordering is broken, and should be fixed. I can fix that when I have push privileges (I am getting tired of creating a gazillion tickets for small fixes :)

  • Martin Kihlgren

    Martin Kihlgren April 18th, 2008 @ 03:41 AM

    • State changed from “open” to “resolved”

    Now the test is prettier, with each spec (I think, it was a fairl quick hack) running completely on its own, with before :all in each part.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket