Skip to content

Instantly share code, notes, and snippets.

@jch
Created November 11, 2011 16:52
Show Gist options
  • Save jch/1358508 to your computer and use it in GitHub Desktop.
Save jch/1358508 to your computer and use it in GitHub Desktop.
transaction vs truncation for cleaning db's

Database cleaning

  • truncate prevents you from having seed data in test db

  • use txn whenever possible

  • use a separate environment for integration tests?

  • wish environments were inheritable so you can say:

    Environment.configure :integration, :parent => :development do # override configs here. end

  • in :test environment, config.use_transactional_fixtures => true

  • separate :integration environment, config.use_transactional_fixtures => false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment